awacke1's picture
Update app.py
9d8750a
raw
history blame
944 Bytes
# original:
#import gradio as gr
#gr.Interface.load("models/sileod/deberta-v3-base-tasksource-nli").launch()
# chatGPT prompt1: Rewrite this program in python and gradio to load an example file with two input text fields and output of the classification field.
import gradio as gr
def classify_text(text1, text2):
# Load pre-trained model
model = gr.load_model("models/sileod/deberta-v3-base-tasksource-nli")
# Perform classification on input text
output = model.predict([text1, text2])[0]
return output
# Create input fields
input_text1 = gr.Textbox(label="Input Text 1")
input_text2 = gr.Textbox(label="Input Text 2")
# Create output field
output_text = gr.Textbox(label="Classification Output")
# Create Gradio interface
gr.Interface(classify_text,
inputs=[input_text1, input_text2],
outputs=output_text,
examples=[["Example Text 1", "Example Text 2"]]).launch()