Download src/streamlit_app.py from Sanya2025/LLM: direct link, hf CLI and curl.
- Browser
- Download file 720 Bytes
-
https://huggingface.co/spaces/Sanya2025/LLM/resolve/main/src/streamlit_app.py
- Command line
-
hf download hf://spaces/Sanya2025/LLM/src/streamlit_app.py
-
curl -L -o streamlit_app.py https://huggingface.co/spaces/Sanya2025/LLM/resolve/main/src/streamlit_app.py
720 Bytes
| import streamlit as st | |
| from fastapi import FastAPI | |
| import uvicorn | |
| # FastAPI для API-эндпоинтов | |
| api = FastAPI() | |
| def get_data(): | |
| return {"message": "Hello from FastAPI!"} | |
| # Streamlit-приложение | |
| st.title("Streamlit + FastAPI") | |
| st.write("Откройте http://localhost:8000/api/data для API") | |
| # Запуск FastAPI в отдельном потоке | |
| import threading | |
| def run_fastapi(): | |
| uvicorn.run(api, host="0.0.0.0", port=8000) | |
| thread = threading.Thread(target=run_fastapi, daemon=True) | |
| thread.start() | |
| # Основной Streamlit-код | |
| user_input = st.text_input("Введите что-то") | |
| if user_input: | |
| st.write(f"Вы ввели: {user_input}") |