Spaces:
Runtime error
Runtime error
cuneytkaya
commited on
Commit
•
bd82b4d
1
Parent(s):
5fb4313
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import T5Tokenizer, T5ForConditionalGeneration
|
3 |
+
|
4 |
+
tokenizer = T5Tokenizer.from_pretrained("cuneytkaya/fintech-chatbot-t5")
|
5 |
+
model = T5ForConditionalGeneration.from_pretrained("cuneytkaya/fintech-chatbot-t5")
|
6 |
+
|
7 |
+
def chatbot(input_text):
|
8 |
+
inputs = tokenizer(input_text, return_tensors="pt")
|
9 |
+
outputs = model.generate(inputs.input_ids)
|
10 |
+
return tokenizer.decode(outputs[0], skip_special_tokens=True)
|
11 |
+
|
12 |
+
interface = gr.Interface(fn=chatbot,
|
13 |
+
inputs="text",
|
14 |
+
outputs="text",
|
15 |
+
title="Fintech Chatbot",
|
16 |
+
description="This chatbot answers common fintech and banking-related queries.")
|
17 |
+
|
18 |
+
interface.launch(share=True)
|