Spaces:
Sleeping
Sleeping
app.py
Browse files
app.py
CHANGED
|
@@ -1,31 +1,25 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import InferenceClient
|
| 3 |
|
| 4 |
-
client = InferenceClient(model="
|
| 5 |
|
| 6 |
def generate_caption(prompt):
|
| 7 |
-
prompt = f""
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
- Premium tone
|
| 16 |
-
- No long paragraphs
|
| 17 |
-
|
| 18 |
-
Output:
|
| 19 |
-
"""
|
| 20 |
-
response = client.text_generation(prompt, max_new_tokens=120)
|
| 21 |
return response
|
| 22 |
|
| 23 |
iface = gr.Interface(
|
| 24 |
fn=generate_caption,
|
| 25 |
inputs=gr.Textbox(placeholder="Enter product (e.g. gold earrings)"),
|
| 26 |
outputs=gr.Textbox(label="Captions"),
|
| 27 |
-
title="✨ AI
|
| 28 |
-
description="Generate
|
| 29 |
)
|
| 30 |
|
| 31 |
iface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import InferenceClient
|
| 3 |
|
| 4 |
+
client = InferenceClient(model="tiiuae/falcon-7b-instruct")
|
| 5 |
|
| 6 |
def generate_caption(prompt):
|
| 7 |
+
prompt = f"Write 3 short luxury Instagram captions for: {prompt}"
|
| 8 |
+
|
| 9 |
+
response = client.text_generation(
|
| 10 |
+
prompt,
|
| 11 |
+
max_new_tokens=100,
|
| 12 |
+
temperature=0.7
|
| 13 |
+
)
|
| 14 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
return response
|
| 16 |
|
| 17 |
iface = gr.Interface(
|
| 18 |
fn=generate_caption,
|
| 19 |
inputs=gr.Textbox(placeholder="Enter product (e.g. gold earrings)"),
|
| 20 |
outputs=gr.Textbox(label="Captions"),
|
| 21 |
+
title="✨ AI Caption Generator",
|
| 22 |
+
description="Generate clean luxury captions"
|
| 23 |
)
|
| 24 |
|
| 25 |
iface.launch()
|