Multiverse26 commited on
Commit
b6a5a96
·
verified ·
1 Parent(s): 1f936a8
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -1,21 +1,21 @@
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
 
3
 
4
  client = InferenceClient(
5
- model="tiiuae/falcon-7b-instruct",
6
- token="my-first-token"
7
  )
8
 
9
  def generate_caption(prompt):
10
- prompt = f"Write 3 short luxury Instagram captions for: {prompt}"
11
 
12
  response = client.text_generation(
13
  prompt,
14
- max_new_tokens=100,
15
- temperature=0.7
16
  )
17
 
18
- return response
19
 
20
  iface = gr.Interface(
21
  fn=generate_caption,
 
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
+ import os
4
 
5
  client = InferenceClient(
6
+ model="google/flan-t5-base",
7
+ token=os.getenv("my-first-token")
8
  )
9
 
10
  def generate_caption(prompt):
11
+ prompt = f"Write 3 short luxury Instagram captions for: {prompt}. Keep them elegant and minimal."
12
 
13
  response = client.text_generation(
14
  prompt,
15
+ max_new_tokens=80
 
16
  )
17
 
18
+ return response.strip()
19
 
20
  iface = gr.Interface(
21
  fn=generate_caption,