Spaces:
Runtime error
Runtime error
springwater
commited on
Commit
β’
b7f4bba
1
Parent(s):
acc7635
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# μκΈ°μκ°μ μμ± λͺ¨λΈ μ΄κΈ°ν
|
5 |
+
generator = pipeline('text-generation', model='distilbart-cnn-12-6')
|
6 |
+
|
7 |
+
def generate_self_introduction(job, strength, weakness, major, experience):
|
8 |
+
# μ
λ ₯ ν€μλ μ²λ¦¬
|
9 |
+
job = job.strip()
|
10 |
+
strength = [s.strip() for s in strength.split(',')]
|
11 |
+
weakness = [w.strip() for w in weakness.split(',')]
|
12 |
+
major = major.strip()
|
13 |
+
experience = [e.strip() for e in experience.split(',')]
|
14 |
+
|
15 |
+
# μκΈ°μκ°μ μμ±
|
16 |
+
intro = f'μλ
νμΈμ, {job} μ§λ¬΄μ μ§μνλ [μ΄λ¦]μ
λλ€.\n'
|
17 |
+
intro += f'μ λ {major} μ 곡 μΆμ μΌλ‘ {experience[0]} κ²½νμ΄ μμ΅λλ€.\n'
|
18 |
+
intro += f'μ μ μ±κ²© μ₯μ μ {", ".join(strength)}μ
λλ€.\n'
|
19 |
+
intro += f'μ μ μ±κ²© λ¨μ μ {", ".join(weakness)}μ
λλ€.\n'
|
20 |
+
intro += generator(job, max_length=5000, num_return_sequences=1)[0]['generated_text']
|
21 |
+
|
22 |
+
return intro
|
23 |
+
|
24 |
+
# Gradio μΈν°νμ΄μ€ μμ±
|
25 |
+
iface = gr.Interface(
|
26 |
+
fn=generate_self_introduction,
|
27 |
+
inputs=[
|
28 |
+
gr.Textbox(label='μ·¨μ
ν μ§λ¬΄ μ΄λ¦'),
|
29 |
+
gr.Textbox(label='λμ μ±κ²© μ₯μ (μ½€λ§λ‘ ꡬλΆ)'),
|
30 |
+
gr.Textbox(label='λμ μ±κ²© λ¨μ (μ½€λ§λ‘ ꡬλΆ)'),
|
31 |
+
gr.Textbox(label='μ 곡'),
|
32 |
+
gr.Textbox(label='λμΈνλ κ²½ν (μ½€λ§λ‘ ꡬλΆ)'),
|
33 |
+
],
|
34 |
+
outputs=gr.Textbox(label='μκΈ°μκ°μ'),
|
35 |
+
title='μκΈ°μκ°μ μμ± μλΉμ€',
|
36 |
+
description='μ·¨μ
ν μ§λ¬΄ μ΄λ¦, λμ μ±κ²© μ₯μ , λμ μ±κ²© λ¨μ , μ 곡, λμΈνλ κ²½νμ μ
λ ₯νμ¬ μκΈ°μκ°μλ₯Ό μμ±ν©λλ€.'
|
37 |
+
)
|
38 |
+
|
39 |
+
# Gradio μ ν리μΌμ΄μ
μ€ν
|
40 |
+
iface.launch()
|