NAGARRO\dikshasingh
commited on
Commit
•
3daed5d
1
Parent(s):
290564f
updating aap
Browse files
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import requests
|
3 |
+
|
4 |
+
API_URL = "https://api-inference.huggingface.co/models/ahmedrachid/FinancialBERT-Sentiment-Analysis"
|
5 |
+
headers = {"Authorization": "Bearer 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"}
|
6 |
+
|
7 |
+
def query(payload):
|
8 |
+
response = requests.post(API_URL, headers=headers, json=payload)
|
9 |
+
return response.json()
|
10 |
+
|
11 |
+
def greet(text):
|
12 |
+
output = query({
|
13 |
+
"inputs": text,
|
14 |
+
})
|
15 |
+
return output
|
16 |
+
|
17 |
+
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
18 |
+
iface.launch()
|