ck commited on
Commit
b90a33e
β€’
1 Parent(s): a7cdf58
.ipynb_checkpoints/README-checkpoint.md ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Hackaithon101
3
+ emoji: πŸ“ˆ
4
+ colorFrom: pink
5
+ colorTo: green
6
+ sdk: gradio
7
+ sdk_version: 4.19.2
8
+ app_file: app.py
9
+ pinned: false
10
+ ---
11
+
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import gradio as gr
3
+ import requests
4
+ import os
5
+
6
+ API_URL = "https://api-inference.huggingface.co/models/cardiffnlp/twitter-roberta-base-sentiment"
7
+
8
+ bt = os.environ['HACKAITHONBEARERTOKEN']
9
+ headers = {"Authorization": bt }
10
+
11
+ def query(data):
12
+ response = requests.post(API_URL, headers=headers, json=data)
13
+ return "V2"+str(response.json())
14
+
15
+ def greet(howareyoufeeling):
16
+ output = query({"inputs":howareyoufeeling})
17
+ print (str(output))
18
+ return str(output)
19
+
20
+ iface = gr.Interface(
21
+ fn=greet, inputs=["text"], outputs="text", allow_flagging="never")
22
+ iface.launch()
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+
2
+ gradio==3.48.0
3
+ requests
4
+ fastai