vidhishiste's picture
dark theme
6ce4f53
import gradio as gr
def greet(name):
return "Hello " + name + "!!"
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
iface.launch()
from gradio import Interface, Textbox, Button, css
# Define the theme
theme = css.Theme(
background="#212529",
text_color="#f8f9fa",
button_color="#4285f4",
button_text_color="#ffffff",
)
# Define the UI components
input_box = Textbox(label="Input:", placeholder="Enter your text here...", theme=theme)
submit_button = Button("Submit", theme=theme)
output_box = Textbox(label="Output:", theme=theme)
# Define the function to handle the input
def handle_input(text):
# Replace this with your actual processing logic
output_text = f"Processed input: {text}"
return output_text
# Create the interface
interface = Interface(
fn=handle_input,
inputs=[input_box, submit_button],
outputs=[output_box],
layout="horizontal",
title="Dark Theme UI",
theme=theme,
)
# Launch the interface
# interface.launch()
# import gradio as gr
# from speech_recognition import Recognizer, Microphone
# # Initialize speech recognizer
# recognizer = Recognizer()
# def speech_to_text(input_text=None):
# """
# Speech to text function
# """
# # Record audio
# with Microphone() as source:
# recognizer.adjust_for_ambient_noise(source)
# audio = recognizer.listen(source)
# # Recognize speech
# try:
# text = recognizer.recognize_google(audio)
# output_text = f"You said: {text}"
# except Exception as e:
# print(e)
# output_text = "Could not understand your speech. Please try again!"
# return output_text
# # Create Gradio interface
# iface = gr.Interface(
# fn=speech_to_text,
# inputs=[],
# outputs=gr.Textbox(label="Transcription"),
# title="Speech to Text",
# theme="dark",
# )
# # Launch the interface
# iface.launch()