Spaces:
Build error
Build error
Update main.py
Browse files
main.py
CHANGED
@@ -1,15 +1,22 @@
|
|
1 |
import gradio as gr
|
2 |
-
import freqtrade
|
3 |
-
import
|
4 |
|
5 |
-
|
6 |
-
|
7 |
|
|
|
|
|
|
|
|
|
|
|
8 |
iface = gr.Interface(
|
9 |
-
fn=
|
10 |
-
inputs="
|
11 |
-
outputs="
|
12 |
-
title="
|
13 |
)
|
14 |
|
15 |
-
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
import freqtrade.strategy.interface as strategy
|
3 |
+
from transformers import pipeline
|
4 |
|
5 |
+
# مدل Transformer برای تحلیل بازار
|
6 |
+
nlp = pipeline("sentiment-analysis")
|
7 |
|
8 |
+
def analyze_text(text):
|
9 |
+
result = nlp(text)
|
10 |
+
return result[0]['label'], result[0]['score']
|
11 |
+
|
12 |
+
# ساخت رابط کاربری
|
13 |
iface = gr.Interface(
|
14 |
+
fn=analyze_text,
|
15 |
+
inputs=gr.Textbox(label="Enter Market News"),
|
16 |
+
outputs=[gr.Textbox(label="Sentiment"), gr.Textbox(label="Confidence")],
|
17 |
+
title="Market Sentiment Analyzer",
|
18 |
)
|
19 |
|
20 |
+
# اجرای برنامه
|
21 |
+
if __name__ == "__main__":
|
22 |
+
iface.launch(server_name="0.0.0.0", server_port=7860)
|