Update main.py
Browse files
main.py
CHANGED
|
@@ -2,6 +2,7 @@ import os
|
|
| 2 |
import time
|
| 3 |
import streamlit as st
|
| 4 |
import requests
|
|
|
|
| 5 |
|
| 6 |
OPENROUTER_API_KEY = os.getenv("OPENROUTER_API_KEY")
|
| 7 |
MODEL = "nousresearch/hermes-3-llama-3.1-405b:free"
|
|
@@ -51,4 +52,22 @@ if prompt := st.chat_input("Ask Hermes anything…"):
|
|
| 51 |
st.markdown(reply)
|
| 52 |
st.session_state.messages.append({"role": "assistant", "content": reply})
|
| 53 |
else:
|
| 54 |
-
st.error(error)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
import time
|
| 3 |
import streamlit as st
|
| 4 |
import requests
|
| 5 |
+
from daytona import Daytona, DaytonaConfig
|
| 6 |
|
| 7 |
OPENROUTER_API_KEY = os.getenv("OPENROUTER_API_KEY")
|
| 8 |
MODEL = "nousresearch/hermes-3-llama-3.1-405b:free"
|
|
|
|
| 52 |
st.markdown(reply)
|
| 53 |
st.session_state.messages.append({"role": "assistant", "content": reply})
|
| 54 |
else:
|
| 55 |
+
st.error(error)
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
# Define the configuration
|
| 60 |
+
config = DaytonaConfig(api_key="dtn_ffb3eb0b8d530b699ba6f13eb933601286c560f4ccf1c0e12ec010d26dba0fd8")
|
| 61 |
+
|
| 62 |
+
# Initialize the Daytona client
|
| 63 |
+
daytona = Daytona(config)
|
| 64 |
+
|
| 65 |
+
# Create the Sandbox instance
|
| 66 |
+
sandbox = daytona.create()
|
| 67 |
+
|
| 68 |
+
# Run the code securely inside the Sandbox
|
| 69 |
+
response = sandbox.process.code_run('print("Hello World from code!")')
|
| 70 |
+
if response.exit_code != 0:
|
| 71 |
+
print(f"Error: {response.exit_code} {response.result}")
|
| 72 |
+
else:
|
| 73 |
+
print(response.result)
|