Spaces:
Runtime error
Runtime error
ankush-003
commited on
Commit
•
6ef3ddb
1
Parent(s):
b54e71a
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,17 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
-
gr.Interface
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
def predict(payload, payload_label):
|
3 |
+
inputs = tokenizer(test_payload, return_tensors="tf")
|
4 |
+
model = TFAutoModelForSequenceClassification.from_pretrained("models/ankush-003/nosqli_identifier")
|
5 |
+
logits = model(**inputs).logits
|
6 |
+
predicted_class_id = int(tf.math.argmax(logits, axis=-1)[0])
|
7 |
+
# print(model.config.id2label[predicted_class_id])
|
8 |
+
return model.config.id2label[predicted_class_id]
|
9 |
+
# return "Fuck You"
|
10 |
|
11 |
+
demo = gr.Interface(
|
12 |
+
fn=predict,
|
13 |
+
inputs=["text","checkbox"],
|
14 |
+
outputs="text",
|
15 |
+
)
|
16 |
+
demo.launch(share=True, debug=True)
|
17 |
+
# gr.Interface.load("models/ankush-003/nosqli_identifier").launch()
|