Upload 2 files
Browse files- app.py +10 -11
- requirements.txt +3 -1
app.py
CHANGED
@@ -1,15 +1,16 @@
|
|
1 |
import requests as rq
|
2 |
import streamlit as st
|
3 |
-
import
|
|
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
|
|
8 |
|
9 |
|
10 |
-
def query(
|
11 |
-
|
12 |
-
return response.json()
|
13 |
|
14 |
|
15 |
st.title("LLama3 8B T")
|
@@ -17,7 +18,5 @@ st.subheader("This is a demo of the LLama3 8B T model.")
|
|
17 |
|
18 |
user_input = st.text_area("Enter your text here:")
|
19 |
if st.button("Submit"):
|
20 |
-
|
21 |
-
|
22 |
-
})
|
23 |
-
st.write(output)
|
|
|
1 |
import requests as rq
|
2 |
import streamlit as st
|
3 |
+
import transformers
|
4 |
+
import torch
|
5 |
|
6 |
+
model_id = "meta-llama/Meta-Llama-3-8B"
|
7 |
+
pipeline = transformers.pipeline(
|
8 |
+
"text-generation", model=model_id, model_kwargs={"torch_dtype": torch.bfloat16}, device_map="auto"
|
9 |
+
)
|
10 |
|
11 |
|
12 |
+
def query(question):
|
13 |
+
return pipeline(question)
|
|
|
14 |
|
15 |
|
16 |
st.title("LLama3 8B T")
|
|
|
18 |
|
19 |
user_input = st.text_area("Enter your text here:")
|
20 |
if st.button("Submit"):
|
21 |
+
answer = query(user_input)
|
22 |
+
st.write(answer)
|
|
|
|
requirements.txt
CHANGED
@@ -1,2 +1,4 @@
|
|
1 |
requests
|
2 |
-
streamlit
|
|
|
|
|
|
1 |
requests
|
2 |
+
streamlit
|
3 |
+
transformers
|
4 |
+
torch
|