DetectiveShadow commited on
Commit
88956d7
·
verified ·
1 Parent(s): ef7505e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -8
app.py CHANGED
@@ -1,16 +1,19 @@
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
- # Load your model from the Hub
5
- generator = pipeline("text2text-generation", model="DetectiveShadow/inspiration-message-generator")
 
 
 
6
 
7
- # Define your message function
8
  def generate_inspiration(age, profession, archetype):
9
  prompt = f"Age: {age} | Profession: {profession} | Archetype: {archetype}"
10
- result = generator(prompt, max_new_tokens=100)[0]["generated_text"]
11
- return result
12
 
13
- # Gradio interface layout
14
  iface = gr.Interface(
15
  fn=generate_inspiration,
16
  inputs=[
@@ -20,9 +23,8 @@ iface = gr.Interface(
20
  ],
21
  outputs=gr.Textbox(label="Inspirational Message"),
22
  title="Inspiration Message Generator",
23
- description="Enter your age, profession, and archetype to receive a personalized message."
24
  )
25
 
26
- # Run the app
27
  iface.launch()
28
 
 
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
+ # Load your fine-tuned model from Hugging Face Hub
5
+ generator = pipeline(
6
+ "text2text-generation",
7
+ model="DetectiveShadow/inspiration-message-generator" # ← your model name
8
+ )
9
 
10
+ # Function to create the input prompt and get the message
11
  def generate_inspiration(age, profession, archetype):
12
  prompt = f"Age: {age} | Profession: {profession} | Archetype: {archetype}"
13
+ result = generator(prompt, max_new_tokens=100)
14
+ return result[0]["generated_text"]
15
 
16
+ # Gradio interface
17
  iface = gr.Interface(
18
  fn=generate_inspiration,
19
  inputs=[
 
23
  ],
24
  outputs=gr.Textbox(label="Inspirational Message"),
25
  title="Inspiration Message Generator",
26
+ description="Get a personalized motivational message based on your age, profession, and life archetype."
27
  )
28
 
 
29
  iface.launch()
30