Spaces:
Running
on
T4
Running
on
T4
update app
Browse files- AyaExpanse.png +0 -0
- README.md +3 -3
- app.py +6 -6
- aya-expanse.png +0 -3
AyaExpanse.png
ADDED
|
README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
---
|
| 2 |
title: Aya Expanse
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 5.3.0
|
| 8 |
app_file: app.py
|
|
|
|
| 1 |
---
|
| 2 |
title: Aya Expanse
|
| 3 |
+
emoji: π
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: green
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 5.3.0
|
| 8 |
app_file: app.py
|
app.py
CHANGED
|
@@ -94,7 +94,7 @@ def replicate_api_inference(input_prompt):
|
|
| 94 |
return image
|
| 95 |
|
| 96 |
def generate_image(input_prompt, model_id="black-forest-labs/FLUX.1-schnell"):
|
| 97 |
-
if input_prompt
|
| 98 |
if USE_REPLICATE:
|
| 99 |
print("using replicate for image generation")
|
| 100 |
image = replicate_api_inference(input_prompt)
|
|
@@ -112,7 +112,7 @@ def generate_image(input_prompt, model_id="black-forest-labs/FLUX.1-schnell"):
|
|
| 112 |
return None
|
| 113 |
|
| 114 |
def generate_img_prompt(input_prompt):
|
| 115 |
-
if input_prompt
|
| 116 |
# clean prompt before doing language detection
|
| 117 |
cleaned_prompt = clean_text(input_prompt, remove_bullets=True, remove_newline=True)
|
| 118 |
text_lang_code = predict_language(cleaned_prompt)
|
|
@@ -185,7 +185,7 @@ def clear_chat():
|
|
| 185 |
# Audio Pipeline util functions
|
| 186 |
|
| 187 |
def transcribe_and_stream(inputs, model_name="groq_whisper", show_info="show_info", language="english"):
|
| 188 |
-
if inputs
|
| 189 |
if show_info=="show_info":
|
| 190 |
gr.Info("Processing Audio", duration=1)
|
| 191 |
if model_name != "groq_whisper":
|
|
@@ -208,7 +208,7 @@ def transcribe_and_stream(inputs, model_name="groq_whisper", show_info="show_inf
|
|
| 208 |
|
| 209 |
|
| 210 |
def aya_speech_text_response(text):
|
| 211 |
-
if text
|
| 212 |
stream = audio_response_client.chat_stream(message=text,preamble=AUDIO_RESPONSE_PREAMBLE, model=AYA_MODEL_NAME)
|
| 213 |
output = ""
|
| 214 |
|
|
@@ -236,7 +236,7 @@ def clean_text(text, remove_bullets=False, remove_newline=False):
|
|
| 236 |
def convert_text_to_speech(text, language="english"):
|
| 237 |
|
| 238 |
# do language detection to determine voice of speech response
|
| 239 |
-
if text
|
| 240 |
# clean text before doing language detection
|
| 241 |
cleaned_text = clean_text(text, remove_bullets=True, remove_newline=True)
|
| 242 |
text_lang_code = predict_language(cleaned_text)
|
|
@@ -338,7 +338,7 @@ demo = gr.Blocks(theme=theme, analytics_enabled=False)
|
|
| 338 |
with demo:
|
| 339 |
with gr.Row(variant="panel"):
|
| 340 |
with gr.Column(scale=1):
|
| 341 |
-
gr.Image("
|
| 342 |
with gr.Column(scale=30):
|
| 343 |
gr.Markdown("""C4AI Aya Expanse is a state-of-art model with highly advanced capabilities to connect the world across languages.
|
| 344 |
<br/>
|
|
|
|
| 94 |
return image
|
| 95 |
|
| 96 |
def generate_image(input_prompt, model_id="black-forest-labs/FLUX.1-schnell"):
|
| 97 |
+
if input_prompt:
|
| 98 |
if USE_REPLICATE:
|
| 99 |
print("using replicate for image generation")
|
| 100 |
image = replicate_api_inference(input_prompt)
|
|
|
|
| 112 |
return None
|
| 113 |
|
| 114 |
def generate_img_prompt(input_prompt):
|
| 115 |
+
if input_prompt:
|
| 116 |
# clean prompt before doing language detection
|
| 117 |
cleaned_prompt = clean_text(input_prompt, remove_bullets=True, remove_newline=True)
|
| 118 |
text_lang_code = predict_language(cleaned_prompt)
|
|
|
|
| 185 |
# Audio Pipeline util functions
|
| 186 |
|
| 187 |
def transcribe_and_stream(inputs, model_name="groq_whisper", show_info="show_info", language="english"):
|
| 188 |
+
if inputs:
|
| 189 |
if show_info=="show_info":
|
| 190 |
gr.Info("Processing Audio", duration=1)
|
| 191 |
if model_name != "groq_whisper":
|
|
|
|
| 208 |
|
| 209 |
|
| 210 |
def aya_speech_text_response(text):
|
| 211 |
+
if text:
|
| 212 |
stream = audio_response_client.chat_stream(message=text,preamble=AUDIO_RESPONSE_PREAMBLE, model=AYA_MODEL_NAME)
|
| 213 |
output = ""
|
| 214 |
|
|
|
|
| 236 |
def convert_text_to_speech(text, language="english"):
|
| 237 |
|
| 238 |
# do language detection to determine voice of speech response
|
| 239 |
+
if text:
|
| 240 |
# clean text before doing language detection
|
| 241 |
cleaned_text = clean_text(text, remove_bullets=True, remove_newline=True)
|
| 242 |
text_lang_code = predict_language(cleaned_text)
|
|
|
|
| 338 |
with demo:
|
| 339 |
with gr.Row(variant="panel"):
|
| 340 |
with gr.Column(scale=1):
|
| 341 |
+
gr.Image("AyaExpanse.png", elem_id="logo-img", show_label=False, show_share_button=False, show_download_button=False, show_fullscreen_button=False)
|
| 342 |
with gr.Column(scale=30):
|
| 343 |
gr.Markdown("""C4AI Aya Expanse is a state-of-art model with highly advanced capabilities to connect the world across languages.
|
| 344 |
<br/>
|
aya-expanse.png
DELETED
Git LFS Details
|