Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# Hugging Face λͺ¨λΈ λ‘λ
|
5 |
+
generator = pipeline("text-generation", model="bigscience/bloomz-560m")
|
6 |
+
|
7 |
+
# μλ΅ μμ± ν¨μ
|
8 |
+
def generate_reply(review):
|
9 |
+
prompt = f"κ³ κ° λ¦¬λ·°: \"{review}\" μ΄ λ¦¬λ·°μ λν΄ μ μ€νκ³ κ°μ¬μ λ»μ λ΄μ λ΅λ³μ μμ±νμΈμ."
|
10 |
+
result = generator(prompt, max_length=100, do_sample=True, temperature=0.7)
|
11 |
+
return result[0]["generated_text"]
|
12 |
+
|
13 |
+
# Gradio μΈν°νμ΄μ€ μ€μ
|
14 |
+
iface = gr.Interface(
|
15 |
+
fn=generate_reply,
|
16 |
+
inputs="text",
|
17 |
+
outputs="text",
|
18 |
+
title="Review Reply Generator",
|
19 |
+
description="κ³ κ° λ¦¬λ·°λ₯Ό μ
λ ₯νλ©΄ μ μ€ν λ΅λ³μ μμ±ν©λλ€."
|
20 |
+
)
|
21 |
+
|
22 |
+
# Space μ€ν
|
23 |
+
iface.launch()
|