Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,30 @@
|
|
| 1 |
from langchain_huggingface import HuggingFaceEndpoint
|
| 2 |
llm = HuggingFaceEndpoint(repo_id="mistralai/Mistral-7B-Instruct-v0.3")
|
| 3 |
-
our_query = "What is the currency of India?"
|
| 4 |
-
completion= llm.invoke(our_query)
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from langchain_huggingface import HuggingFaceEndpoint
|
| 2 |
llm = HuggingFaceEndpoint(repo_id="mistralai/Mistral-7B-Instruct-v0.3")
|
| 3 |
+
#our_query = "What is the currency of India?"
|
| 4 |
+
#completion= llm.invoke(our_query)
|
| 5 |
+
|
| 6 |
+
#print(completion)
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
@spaces.GPU
|
| 10 |
+
def process_input_with_llm(text_input):
|
| 11 |
+
completion= llm.invoke(text_input)
|
| 12 |
+
print(completion)
|
| 13 |
+
return completion
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
# Define the Gradio interface
|
| 17 |
+
iface = gr.Interface(
|
| 18 |
+
fn=process_input_with_llm,
|
| 19 |
+
inputs=[
|
| 20 |
+
gr.Textbox(label="Input Query"),
|
| 21 |
+
],
|
| 22 |
+
outputs=[
|
| 23 |
+
gr.Textbox(label="Model Output"),
|
| 24 |
+
],
|
| 25 |
+
title="LLM Model ",
|
| 26 |
+
description="LLM Model"
|
| 27 |
+
)
|
| 28 |
+
|
| 29 |
+
# Launch the Gradio app with sharing enabled
|
| 30 |
+
iface.launch(share=True)
|