Update app.py
Browse files
app.py
CHANGED
|
@@ -1,15 +1,9 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
| 7 |
-
|
| 8 |
-
def correct_sentences(text):
|
| 9 |
-
inputs = tokenizer.encode(text, return_tensors="pt", truncation=True)
|
| 10 |
-
outputs = model.generate(inputs, max_length=512)
|
| 11 |
-
return tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 12 |
-
|
| 13 |
-
demo = gr.Interface(fn=correct_sentences, inputs="text", outputs="text", title="Sentence Doctor")
|
| 14 |
|
|
|
|
|
|
|
| 15 |
demo.launch()
|
|
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
+
def greet(name):
|
| 4 |
+
return "Hello " + name + "!!"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
+
# ✅ Gradio Interface를 사용해야 REST API /run/predict 자동 활성화
|
| 7 |
+
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 8 |
demo.launch()
|
| 9 |
+
|