trialApp / app.py
aparnavellala's picture
Update app.py
54bc3fa verified
Raw History Blame Contribute Delete
732 Bytes
from langchain_huggingface import HuggingFaceEndpoint
import spaces
import gradio as gr
llm = HuggingFaceEndpoint(repo_id="mistralai/Mistral-7B-Instruct-v0.3")
#our_query = "What is the currency of India?"
#completion= llm.invoke(our_query)
#print(completion)
@spaces.GPU
def process_input_with_llm(text_input):
completion= llm.invoke(text_input)
print(completion)
return completion
# Define the Gradio interface
iface = gr.Interface(
fn=process_input_with_llm,
inputs=[
gr.Textbox(label="Input Query"),
],
outputs=[
gr.Textbox(label="Model Output"),
],
title="LLM Model ",
description="LLM Model"
)
# Launch the Gradio app with sharing enabled
iface.launch(share=True)