Spaces:
Runtime error
Runtime error
lionelgarnier
commited on
Commit
·
76813dd
1
Parent(s):
19bcaa7
update secret
Browse files
app.py
CHANGED
@@ -8,7 +8,7 @@ from diffusers import DiffusionPipeline
|
|
8 |
from transformers import pipeline
|
9 |
from huggingface_hub import login
|
10 |
|
11 |
-
hf_token = os.
|
12 |
login(token=hf_token)
|
13 |
|
14 |
|
@@ -21,14 +21,12 @@ MAX_SEED = np.iinfo(np.int32).max
|
|
21 |
MAX_IMAGE_SIZE = 2048
|
22 |
|
23 |
def refine_prompt(prompt):
|
24 |
-
gr.Info("Starting process")
|
25 |
chatbot = pipeline("text-generation", model="mistralai/Mistral-7B-Instruct-v0.3")
|
26 |
messages = [
|
27 |
{"role": "system", "content": "You are a product designer. You will get a basic prompt of product request and you need to imagine a new product design to satisfy that need. Produce an extended description of product front view that will be use by Flux to generate a visual"},
|
28 |
{"role": "user", "content": prompt},
|
29 |
]
|
30 |
refined_prompt = chatbot(messages)
|
31 |
-
gr.Info("Ending process")
|
32 |
return refined_prompt
|
33 |
|
34 |
@spaces.GPU()
|
@@ -61,6 +59,8 @@ css="""
|
|
61 |
|
62 |
with gr.Blocks(css=css) as demo:
|
63 |
|
|
|
|
|
64 |
with gr.Column(elem_id="col-container"):
|
65 |
gr.Markdown(f"""# Text to Product
|
66 |
Using Mistral + Flux + Trellis
|
|
|
8 |
from transformers import pipeline
|
9 |
from huggingface_hub import login
|
10 |
|
11 |
+
hf_token = os.getenv("hf_token")
|
12 |
login(token=hf_token)
|
13 |
|
14 |
|
|
|
21 |
MAX_IMAGE_SIZE = 2048
|
22 |
|
23 |
def refine_prompt(prompt):
|
|
|
24 |
chatbot = pipeline("text-generation", model="mistralai/Mistral-7B-Instruct-v0.3")
|
25 |
messages = [
|
26 |
{"role": "system", "content": "You are a product designer. You will get a basic prompt of product request and you need to imagine a new product design to satisfy that need. Produce an extended description of product front view that will be use by Flux to generate a visual"},
|
27 |
{"role": "user", "content": prompt},
|
28 |
]
|
29 |
refined_prompt = chatbot(messages)
|
|
|
30 |
return refined_prompt
|
31 |
|
32 |
@spaces.GPU()
|
|
|
59 |
|
60 |
with gr.Blocks(css=css) as demo:
|
61 |
|
62 |
+
info = gr.Info("...")
|
63 |
+
|
64 |
with gr.Column(elem_id="col-container"):
|
65 |
gr.Markdown(f"""# Text to Product
|
66 |
Using Mistral + Flux + Trellis
|