|
import os |
|
import streamlit as st |
|
import requests |
|
from dotenv import load_dotenv |
|
|
|
|
|
load_dotenv() |
|
|
|
|
|
API_URL = "https://nakheeltech.com:8030/api/v1/prediction/c1681ef1-8f47-4004-b4ab-594fbbd3eb3f" |
|
headers = {"Authorization": f"Bearer {os.getenv('FLOWISE_API')}"} |
|
|
|
|
|
def query(payload): |
|
response = requests.post(API_URL, headers=headers, json=payload) |
|
return response.json() |
|
|
|
|
|
st.title("AWS Architecture Diagram Generator") |
|
|
|
|
|
user_input = st.text_area("Describe your architecture:", |
|
placeholder="Enter a description of your architecture here...") |
|
|
|
if st.button("Generate Diagram"): |
|
if user_input: |
|
|
|
payload = {"question": user_input} |
|
output = query(payload) |
|
print(output) |
|
|
|
|
|
if "diagram_url" in output: |
|
st.image(output["diagram_url"], caption="Generated Architecture Diagram") |
|
else: |
|
st.write("Response:", output) |
|
else: |
|
st.warning("Please enter an architecture description.") |
|
|