Spaces:
Build error
Build error
Update llamacpp_python/base/app.py
Browse files- llamacpp_python/base/app.py +22 -1
llamacpp_python/base/app.py
CHANGED
|
@@ -21,4 +21,25 @@ st.write("This is a Streamlit app that says 'Hello, World!'.")
|
|
| 21 |
# Add some interactivity (optional)
|
| 22 |
user_name = st.text_input("Enter your name:")
|
| 23 |
if user_name:
|
| 24 |
-
st.write(f"Hello, {user_name}!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
# Add some interactivity (optional)
|
| 22 |
user_name = st.text_input("Enter your name:")
|
| 23 |
if user_name:
|
| 24 |
+
st.write(f"Hello, {user_name}!")
|
| 25 |
+
|
| 26 |
+
from flask import Flask, request, jsonify
|
| 27 |
+
|
| 28 |
+
app = Flask(__name__)
|
| 29 |
+
|
| 30 |
+
@app.route("/generate", methods=["POST"])
|
| 31 |
+
def generate():
|
| 32 |
+
data = request.json
|
| 33 |
+
prompt = data.get("prompt", "")
|
| 34 |
+
# Simulate a response from the model
|
| 35 |
+
response = f"Generated response for: {prompt}"
|
| 36 |
+
return jsonify({"response": response})
|
| 37 |
+
|
| 38 |
+
if __name__ == "__main__":
|
| 39 |
+
app.run(host="0.0.0.0", port=8001)
|
| 40 |
+
|
| 41 |
+
#Run the server:
|
| 42 |
+
#```bash
|
| 43 |
+
##python model_server.py
|
| 44 |
+
#```
|
| 45 |
+
|