Update app.py
Browse files
app.py
CHANGED
@@ -34,6 +34,27 @@ def index():
|
|
34 |
'''
|
35 |
return html
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
if __name__ == "__main__":
|
39 |
app.run(host="0.0.0.0", port=7860)
|
|
|
34 |
'''
|
35 |
return html
|
36 |
|
37 |
+
@app.route('/<library>/llms.txt')
|
38 |
+
def llm_text(library):
|
39 |
+
# Replace this URL with your actual file URL
|
40 |
+
remote_url = f"https://huggingface.co/mishig/llms-txt/raw/main/{library}.txt"
|
41 |
+
|
42 |
+
try:
|
43 |
+
# Fetch the remote file
|
44 |
+
response = requests.get(remote_url)
|
45 |
+
response.raise_for_status() # Raise an exception for bad status codes
|
46 |
+
|
47 |
+
# Return the content as a text file
|
48 |
+
return Response(
|
49 |
+
response.text,
|
50 |
+
mimetype='text/plain',
|
51 |
+
headers={
|
52 |
+
'Content-Disposition': 'inline',
|
53 |
+
'Cache-Control': 'no-cache'
|
54 |
+
}
|
55 |
+
)
|
56 |
+
except requests.RequestException as e:
|
57 |
+
return f"Error fetching file: {str(e)}", 500
|
58 |
|
59 |
if __name__ == "__main__":
|
60 |
app.run(host="0.0.0.0", port=7860)
|