memex-in commited on
Commit
6e7e9c9
·
verified ·
1 Parent(s): 0ffef35

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -0
app.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import torch
3
+ from transformers import Qwen2_5OmniForConditionalGeneration, Qwen2_5OmniProcessor
4
+
5
+ # Load the model and processor
6
+ model = Qwen2_5OmniForConditionalGeneration.from_pretrained("Qwen/Qwen2.5-Omni-7B", torch_dtype="auto", device_map="auto")
7
+ processor = Qwen2_5OmniProcessor.from_pretrained("Qwen/Qwen2.5-Omni-7B")
8
+
9
+ # Streamlit app title
10
+ st.title("Cryptocurrency Price Prediction")
11
+
12
+ # User input for cryptocurrency and time frame
13
+ crypto = st.text_input("Enter Cryptocurrency (e.g., Bitcoin, Ethereum):")
14
+ time_frame = st.selectbox("Select Time Frame:", ["1 Hour", "1 Day", "1 Week", "1 Month"])
15
+
16
+ # Button to predict price
17
+ if st.button("Predict Price"):
18
+ if crypto:
19
+ # Prepare input for the model
20
+ input_text = f"Predict the price of {crypto} for the next {time_frame}."
21
+ inputs = processor(input_text, return_tensors="pt", padding=True).to(model.device)
22
+
23
+ # Generate prediction
24
+ with torch.no_grad():
25
+ output = model.generate(**inputs)
26
+
27
+ # Decode the output
28
+ prediction = processor.batch_decode(output, skip_special_tokens=True)[0]
29
+
30
+ # Display the prediction
31
+ st.success(f"The predicted price of {crypto} for the next {time_frame} is: {prediction}")
32
+ else:
33
+ st.error("Please enter a cryptocurrency name.")