Spaces:
Runtime error
Runtime error
import gradio as gr | |
from flask import Flask, render_template | |
# Initialize Flask app | |
app = Flask(__name__) | |
# Chatbot Functionality | |
def chatbot_response(input_text): | |
# Example response using OpenAI | |
response = "You said: " + input_text | |
return response | |
# Voice AI Functionality | |
def voice_transcription(audio): | |
# Example voice transcription | |
transcription = audio | |
return transcription | |
# Define Chatbot UI | |
def chatbot_ui(input_text): | |
return chatbot_response(input_text) | |
# Define Voice Chat UI | |
def voice_ui(audio): | |
return voice_transcription(audio) | |
# Web interface for chatbot | |
gr.Interface( | |
fn=chatbot_ui, | |
inputs=gr.inputs.Textbox(label="Type your message"), | |
outputs=gr.outputs.Textbox(label="Response"), | |
live=True | |
).launch() | |
# Web interface for voice interaction | |
gr.Interface( | |
fn=voice_ui, | |
inputs=gr.inputs.Audio(label="Speak your message"), | |
outputs=gr.outputs.Textbox(label="Transcription"), | |
live=True | |
).launch() | |