davidgaofc's picture
yeah
84e65f7
raw
history blame
958 Bytes
import gradio as gr
import requests
# Set your Hugging Face API key here
API_KEY = "your_huggingface_api_key"
def generate_text(input_text):
return input_text
def analyze_sentiment(input_text):
return input_text
def echo_text(input_text):
return input_text
# Define the Gradio interface
interface = gr.Interface(
[
generate_text, # Text generation
analyze_sentiment, # Sentiment analysis
echo_text # Echo text
],
inputs=[
gr.Textbox(lines=2, placeholder="Enter text for generation..."),
gr.Textbox(lines=2, placeholder="Enter text for sentiment analysis..."),
gr.Textbox(lines=2, placeholder="Enter text to echo...")
],
outputs=[
"text",
"text",
"text"
],
title="Multiple Hugging Face Models",
description="Three different functions: Text generation, Sentiment Analysis, and Echo."
)
if __name__ == "__main__":
interface.launch()