Update app.py
Browse files
app.py
CHANGED
@@ -23,7 +23,6 @@ def convert_audio_to_text(audio_file):
|
|
23 |
Returns:
|
24 |
The transcribed text.
|
25 |
"""
|
26 |
-
# The pipeline expects the audio file path (or file-like object)
|
27 |
transcription = asr_pipeline(audio_file)["text"]
|
28 |
return transcription
|
29 |
|
@@ -114,7 +113,6 @@ def generate_image(prompt: str, style: str):
|
|
114 |
Returns:
|
115 |
A tuple containing the path to the generated image and a status message.
|
116 |
"""
|
117 |
-
# Modify the prompt based on the selected style.
|
118 |
if style == "Logo":
|
119 |
modified_prompt = f"{prompt}, logo design, minimalistic, vector art"
|
120 |
elif style == "Wallpaper":
|
@@ -126,7 +124,6 @@ def generate_image(prompt: str, style: str):
|
|
126 |
else: # General
|
127 |
modified_prompt = prompt
|
128 |
|
129 |
-
# Generate the image using the modified prompt.
|
130 |
image = image_generation_tool(prompt=modified_prompt)
|
131 |
if not isinstance(image, str):
|
132 |
image_path = "output_image.png"
|
@@ -155,7 +152,6 @@ def generate_image_from_input(input_mode: str, text_prompt: str, audio_prompt, s
|
|
155 |
A tuple containing the generated image and a status message.
|
156 |
"""
|
157 |
if input_mode == "Speech":
|
158 |
-
# Convert the audio input to text.
|
159 |
try:
|
160 |
prompt_text = convert_audio_to_text(audio_prompt)
|
161 |
except Exception as e:
|
@@ -183,7 +179,6 @@ interface = gr.Interface(
|
|
183 |
value="A high-res, photorealistic image of a cat, sitting on a windowsill, looking outside."
|
184 |
),
|
185 |
gr.Audio(
|
186 |
-
source="microphone",
|
187 |
type="filepath",
|
188 |
label="Speak Your Prompt (if Speech mode selected)"
|
189 |
),
|
|
|
23 |
Returns:
|
24 |
The transcribed text.
|
25 |
"""
|
|
|
26 |
transcription = asr_pipeline(audio_file)["text"]
|
27 |
return transcription
|
28 |
|
|
|
113 |
Returns:
|
114 |
A tuple containing the path to the generated image and a status message.
|
115 |
"""
|
|
|
116 |
if style == "Logo":
|
117 |
modified_prompt = f"{prompt}, logo design, minimalistic, vector art"
|
118 |
elif style == "Wallpaper":
|
|
|
124 |
else: # General
|
125 |
modified_prompt = prompt
|
126 |
|
|
|
127 |
image = image_generation_tool(prompt=modified_prompt)
|
128 |
if not isinstance(image, str):
|
129 |
image_path = "output_image.png"
|
|
|
152 |
A tuple containing the generated image and a status message.
|
153 |
"""
|
154 |
if input_mode == "Speech":
|
|
|
155 |
try:
|
156 |
prompt_text = convert_audio_to_text(audio_prompt)
|
157 |
except Exception as e:
|
|
|
179 |
value="A high-res, photorealistic image of a cat, sitting on a windowsill, looking outside."
|
180 |
),
|
181 |
gr.Audio(
|
|
|
182 |
type="filepath",
|
183 |
label="Speak Your Prompt (if Speech mode selected)"
|
184 |
),
|