Spaces:
Runtime error
Runtime error
Update app.py
Browse files1212311 unmodified lines151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677153 unmodified lines231232233179234235236237196 unmodified lines43443543638243743843948 unmodified lines48848949043749149249349413 unmodified lines508509510457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513511512513# Welcome to Team Tonic's MultiMed
from gradio_client import Clientimport numpy as npimport gradio as gr11 unmodified linesimport uuid
welcome_message = """# 👋🏻Welcome to ⚕🗣️😷MultiMed - Access Chat ⚕🗣️😷
🗣️📝 This is an educational and accessible conversational tool.
### How To Use ⚕🗣️😷MultiMed⚕:
🗣️📝Interact with ⚕🗣️😷MultiMed⚕ in any language using image, audio or text!
📚🌟💼 that uses [Tonic/stablemed](https://huggingface.co/Tonic/stablemed) and [adept/fuyu-8B](https://huggingface.co/adept/fuyu-8b) with [Vectara](https://huggingface.co/vectara) embeddings + retrieval. do [get in touch](https://discord.gg/GWpVpekp). You can also use 😷MultiMed⚕️ on your own data & in your own way by cloning this space. 🧬🔬🔍 Simply click here: <a style="display:inline-block" href="https://huggingface.co/spaces/TeamTonic/MultiMed?duplicate=true"><img src="https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&logoWidth=14" alt="Duplicate Space"></a></h3>### Join us :
🌟TeamTonic🌟 is always making cool demos! Join our active builder's🛠️community on 👻Discord: [Discord](https://discord.gg/GWpVpekp) On 🤗Huggingface: [TeamTonic](https://huggingface.co/TeamTonic) & [MultiTransformer](https://huggingface.co/MultiTransformer) On 🌐Github: [Polytonic](https://github.com/tonic-ai) & contribute to 🌟 [PolyGPT](https://github.com/tonic-ai/polygpt-alpha)" """
languages = { "English": "eng", "Modern Standard Arabic": "arb", "Bengali": "ben", "Catalan": "cat", "Czech": "ces", "Mandarin Chinese": "cmn", "Welsh": "cym", "Danish": "dan", "German": "deu", "Estonian": "est", "Finnish": "fin", "French": "fra", "Hindi": "hin", "Indonesian": "ind", "Italian": "ita", "Japanese": "jpn", "Korean": "kor", "Maltese": "mlt", "Dutch": "nld", "Western Persian": "pes", "Polish": "pol", "Portuguese": "por", "Romanian": "ron", "Russian": "rus", "Slovak": "slk", "Spanish": "spa", "Swedish": "swe", "Swahili": "swh", "Telugu": "tel", "Tagalog": "tgl", "Thai": "tha", "Turkish": "tur", "Ukrainian": "ukr", "Urdu": "urd", "Northern Uzbek": "uzn", "Vietnamese": "vie"}
# Global variables to hold component referencescomponents = {}dotenv.load_dotenv()153 unmodified lines return audio_file_path, translated_text
except Exception as e: return f"Error in text-to-speech conversion: {str(e)}", "" return None, f"Error in text-to-speech conversion: {str(e)}"
def process_image(image_input):196 unmodified lines combined_text = "" markdown_output = "" image_text = "" # Initialize language code language_code = None
# Convert input language to its code48 unmodified lines final_response = process_summary_with_stablemed(summary)
# Convert translated text to speech and get both audio file and text target_language = "English" # Set the target language for the speech target_language = "eng" # Set the target language for the speech audio_output, translated_text = convert_text_to_speech(final_response, target_language, language_code) # Evaluate hallucination13 unmodified lines return f"Error occurred during processing: {e}. No hallucination evaluation.", None
welcome_message = """# 👋🏻Welcome to ⚕🗣️😷MultiMed - Access Chat ⚕🗣️😷
🗣️📝 This is an educational and accessible conversational tool.
### How To Use ⚕🗣️😷MultiMed⚕:
🗣️📝Interact with ⚕🗣️😷MultiMed⚕ in any language using image, audio or text!
📚🌟💼 that uses [Tonic/stablemed](https://huggingface.co/Tonic/stablemed) and [adept/fuyu-8B](https://huggingface.co/adept/fuyu-8b) with [Vectara](https://huggingface.co/vectara) embeddings + retrieval. do [get in touch](https://discord.gg/GWpVpekp). You can also use 😷MultiMed⚕️ on your own data & in your own way by cloning this space. 🧬🔬🔍 Simply click here: <a style="display:inline-block" href="https://huggingface.co/spaces/TeamTonic/MultiMed?duplicate=true"><img src="https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&logoWidth=14" alt="Duplicate Space"></a></h3>### Join us :
🌟TeamTonic🌟 is always making cool demos! Join our active builder's🛠️community on 👻Discord: [Discord](https://discord.gg/GWpVpekp) On 🤗Huggingface: [TeamTonic](https://huggingface.co/TeamTonic) & [MultiTransformer](https://huggingface.co/MultiTransformer) On 🌐Github: [Polytonic](https://github.com/tonic-ai) & contribute to 🌟 [PolyGPT](https://github.com/tonic-ai/polygpt-alpha)" """
languages = { "English": "eng", "Modern Standard Arabic": "arb", "Bengali": "ben", "Catalan": "cat", "Czech": "ces", "Mandarin Chinese": "cmn", "Welsh": "cym", "Danish": "dan", "German": "deu", "Estonian": "est", "Finnish": "fin", "French": "fra", "Hindi": "hin", "Indonesian": "ind", "Italian": "ita", "Japanese": "jpn", "Korean": "kor", "Maltese": "mlt", "Dutch": "nld", "Western Persian": "pes", "Polish": "pol", "Portuguese": "por", "Romanian": "ron", "Russian": "rus", "Slovak": "slk", "Spanish": "spa", "Swedish": "swe", "Swahili": "swh", "Telugu": "tel", "Tagalog": "tgl", "Thai": "tha", "Turkish": "tur", "Ukrainian": "ukr", "Urdu": "urd", "Northern Uzbek": "uzn", "Vietnamese": "vie"}
def clear(): # Return default values for each component return "English", None, None, "", Noneapp.py+59-62