Update app.py
Browse files
app.py
CHANGED
|
@@ -1,11 +1,5 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
from transformers import pipeline
|
| 3 |
-
import os
|
| 4 |
-
from huggingface_hub import login
|
| 5 |
-
|
| 6 |
-
# Hugging Face API Key
|
| 7 |
-
api_key = "your_hugging_face_api_key" # Replace with your API key
|
| 8 |
-
login(api_key)
|
| 9 |
|
| 10 |
# Title of the application
|
| 11 |
st.title("AI Code Bot")
|
|
@@ -23,7 +17,11 @@ user_input = st.text_area("Enter your prompt (e.g., 'Write a Python function to
|
|
| 23 |
@st.cache_resource
|
| 24 |
def load_model():
|
| 25 |
# Use a Hugging Face text-generation model
|
| 26 |
-
model = pipeline(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
return model
|
| 28 |
|
| 29 |
model = load_model()
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
from transformers import pipeline
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
# Title of the application
|
| 5 |
st.title("AI Code Bot")
|
|
|
|
| 17 |
@st.cache_resource
|
| 18 |
def load_model():
|
| 19 |
# Use a Hugging Face text-generation model
|
| 20 |
+
model = pipeline(
|
| 21 |
+
"text-generation",
|
| 22 |
+
model="EleutherAI/gpt-neo-1.3B",
|
| 23 |
+
use_auth_token=True # Automatically uses Hugging Face Space's token
|
| 24 |
+
)
|
| 25 |
return model
|
| 26 |
|
| 27 |
model = load_model()
|