Spaces:
No application file
No application file
Shinhati2023
commited on
Commit
•
cbc53e3
1
Parent(s):
9a9179c
Delete Streamlit app.Py
Browse files- Streamlit app.Py +0 -23
Streamlit app.Py
DELETED
@@ -1,23 +0,0 @@
|
|
1 |
-
# Import the required libraries
|
2 |
-
import streamlit as st
|
3 |
-
from transformers import pipeline
|
4 |
-
|
5 |
-
# Create a calculator function using the Llama model
|
6 |
-
def calculator(expression):
|
7 |
-
# Initialize the Llama model from Hugging Face
|
8 |
-
model = pipeline("text2text-generation", model="EleutherAI/llama")
|
9 |
-
# Generate the answer using the model
|
10 |
-
answer = model(expression)[0]["generated_text"]
|
11 |
-
# Return the answer
|
12 |
-
return answer
|
13 |
-
|
14 |
-
# Create a Streamlit app to display the calculator
|
15 |
-
st.title("Calculator using Llama model")
|
16 |
-
# Get the user input
|
17 |
-
expression = st.text_input("Enter an expression to calculate:")
|
18 |
-
# Check if the input is not empty
|
19 |
-
if expression:
|
20 |
-
# Call the calculator function and display the answer
|
21 |
-
answer = calculator(expression)
|
22 |
-
st.write(f"The answer is: {answer}")
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|