Update app.py
Browse files
app.py
CHANGED
@@ -1,27 +1,9 @@
|
|
1 |
import gradio as gr
|
2 |
-
|
|
|
3 |
|
4 |
-
|
5 |
-
inputs = f"{prompt} {question}"
|
6 |
-
input_ids = tokenizer(inputs, max_length=700, return_tensors="pt").input_ids
|
7 |
-
return input_ids
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
outputs = model.generate(inputs=input_data, num_beams=10, top_k=10, max_length=1024)
|
13 |
-
|
14 |
-
result = tokenizer.decode(token_ids=outputs[0], skip_special_tokens=True)
|
15 |
-
|
16 |
-
# print("question:", question, "answer:", result)
|
17 |
-
return result
|
18 |
-
|
19 |
-
# test_id = 1160
|
20 |
-
# # 거실조명1 꺼주세요 "Home:거실,NickName:조명1,ActionID:1061,Value:없음"
|
21 |
-
# print("model result:", inference(dataset_finetuning["train"][test_id]["Q"]))
|
22 |
-
# print("real result:", dataset_finetuning["train"][test_id]["C"])
|
23 |
-
print(inference("거실 조명1 꺼주세요"))
|
24 |
-
|
25 |
-
gr.load("models/yeye776/t5-OndeviceAI-HomeIoT").launch()
|
26 |
-
# iface = gradio.Interface(fn=pipe_home, inputs="text", outputs="text")
|
27 |
-
# iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
# Use a pipeline as a high-level helper
|
3 |
+
from transformers import pipeline
|
4 |
|
5 |
+
pipe = pipeline("text2text-generation", model="yeye776/t5-OndeviceAI-HomeIoT")
|
|
|
|
|
|
|
6 |
|
7 |
+
# gr.load("models/yeye776/t5-OndeviceAI-HomeIoT").launch()
|
8 |
+
iface = gradio.Interface(fn=pipe, inputs="text", outputs="text")
|
9 |
+
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|