Spaces:
Running
on
Zero
Running
on
Zero
Jonathan Kittell
commited on
Commit
·
21d2028
1
Parent(s):
8167236
Add GPU support and update requirements for spaces library
Browse files- app.py +2 -0
- requirements.txt +1 -0
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
from langchain_huggingface.llms import HuggingFacePipeline
|
3 |
from langchain.prompts import PromptTemplate
|
@@ -19,6 +20,7 @@ prompt = PromptTemplate(
|
|
19 |
# Create a chain with the model pipeline and prompt template
|
20 |
chain = prompt | llm
|
21 |
|
|
|
22 |
def ask_question(question: str) -> str:
|
23 |
# Invoke your chain and return the generated answer.
|
24 |
response = chain.invoke({"question": question})
|
|
|
1 |
+
import spaces
|
2 |
import gradio as gr
|
3 |
from langchain_huggingface.llms import HuggingFacePipeline
|
4 |
from langchain.prompts import PromptTemplate
|
|
|
20 |
# Create a chain with the model pipeline and prompt template
|
21 |
chain = prompt | llm
|
22 |
|
23 |
+
@spaces.GPU
|
24 |
def ask_question(question: str) -> str:
|
25 |
# Invoke your chain and return the generated answer.
|
26 |
response = chain.invoke({"question": question})
|
requirements.txt
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
gradio
|
2 |
langchain
|
3 |
langchain_huggingface
|
|
|
1 |
+
spaces
|
2 |
gradio
|
3 |
langchain
|
4 |
langchain_huggingface
|