HOJOON23 commited on
Commit
fd4767e
Β·
verified Β·
1 Parent(s): fceebbf

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
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()