Spaces:
Runtime error
Runtime error
Commit
·
bee55aa
1
Parent(s):
b7d66ca
Update app.py
Browse files
app.py
CHANGED
@@ -1,22 +1,20 @@
|
|
1 |
import os
|
|
|
2 |
import streamlit as st
|
3 |
-
from langchain import HuggingFaceHub, LLMChain
|
4 |
from git import Repo
|
|
|
5 |
|
6 |
-
#
|
7 |
-
os.system("pip freeze > requirements.txt")
|
8 |
-
os.system("pip install -r requirements.txt")
|
9 |
-
|
10 |
st.set_page_config(layout="wide", initial_sidebar_state="auto", theme="dark")
|
11 |
-
st.title("Hugging Face Space Demo")
|
12 |
|
|
|
13 |
repository_url = st.text_input("Enter GitHub repository URL:", "")
|
14 |
access_token = st.text_input("Enter GitHub access token (optional):", "")
|
15 |
debug_logging = st.checkbox("Enable debug logging")
|
16 |
|
|
|
17 |
if st.button("Run"):
|
18 |
if debug_logging:
|
19 |
-
import logging
|
20 |
logging.basicConfig(filename='log.txt', level=logging.DEBUG, format='%(asctime)s %(message)s')
|
21 |
logging.debug('Starting the process')
|
22 |
|
@@ -29,7 +27,7 @@ if st.button("Run"):
|
|
29 |
hub_llm = HuggingFaceHub(repo_id='google/flan-t5-xl', model_kwargs={'temperature': 1e-10})
|
30 |
|
31 |
# Create a prompt template and LLM chain
|
32 |
-
prompt = "What is the main purpose of the repository at {}?"
|
33 |
llm_chain = LLMChain(prompt=prompt, llm=hub_llm)
|
34 |
|
35 |
# Get the result
|
@@ -38,3 +36,7 @@ if st.button("Run"):
|
|
38 |
|
39 |
if debug_logging:
|
40 |
logging.debug('Finished the process')
|
|
|
|
|
|
|
|
|
|
1 |
import os
|
2 |
+
import logging
|
3 |
import streamlit as st
|
|
|
4 |
from git import Repo
|
5 |
+
from langchain import HuggingFaceHub, LLMChain
|
6 |
|
7 |
+
# Set page configuration
|
|
|
|
|
|
|
8 |
st.set_page_config(layout="wide", initial_sidebar_state="auto", theme="dark")
|
|
|
9 |
|
10 |
+
# Collect user inputs
|
11 |
repository_url = st.text_input("Enter GitHub repository URL:", "")
|
12 |
access_token = st.text_input("Enter GitHub access token (optional):", "")
|
13 |
debug_logging = st.checkbox("Enable debug logging")
|
14 |
|
15 |
+
# Run the process
|
16 |
if st.button("Run"):
|
17 |
if debug_logging:
|
|
|
18 |
logging.basicConfig(filename='log.txt', level=logging.DEBUG, format='%(asctime)s %(message)s')
|
19 |
logging.debug('Starting the process')
|
20 |
|
|
|
27 |
hub_llm = HuggingFaceHub(repo_id='google/flan-t5-xl', model_kwargs={'temperature': 1e-10})
|
28 |
|
29 |
# Create a prompt template and LLM chain
|
30 |
+
prompt = f"What is the main purpose of the repository at {repository_url}?"
|
31 |
llm_chain = LLMChain(prompt=prompt, llm=hub_llm)
|
32 |
|
33 |
# Get the result
|
|
|
36 |
|
37 |
if debug_logging:
|
38 |
logging.debug('Finished the process')
|
39 |
+
|
40 |
+
# Run pip freeze and pip install -r requirements.txt
|
41 |
+
os.system("pip freeze > requirements.txt")
|
42 |
+
os.system("pip install -r requirements.txt")
|