Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
| 1 |
import os
|
| 2 |
import pandas as pd
|
| 3 |
import numpy as np
|
| 4 |
-
import matplotlib.pyplot as plt
|
| 5 |
import streamlit as st
|
| 6 |
import requests
|
| 7 |
|
|
@@ -53,15 +52,6 @@ def analyze_file(uploaded_file):
|
|
| 53 |
st.write(f"Median Gain: {median_gain}")
|
| 54 |
st.write(f"Standard Deviation of Gain: {std_dev_gain}")
|
| 55 |
|
| 56 |
-
# Plotting the data
|
| 57 |
-
fig, ax = plt.subplots()
|
| 58 |
-
ax.plot(freq_values, gain_values, label='Gain (dB)', color='blue')
|
| 59 |
-
ax.set_xlabel('Frequency (GHz)')
|
| 60 |
-
ax.set_ylabel('Gain (dB)')
|
| 61 |
-
ax.set_title('Gain vs Frequency')
|
| 62 |
-
ax.legend()
|
| 63 |
-
st.pyplot(fig)
|
| 64 |
-
|
| 65 |
# Send summary to Groq API for analysis
|
| 66 |
data_summary = f"""
|
| 67 |
The dataset contains simulation results for antennas. The frequency range is from 1 GHz to 10 GHz.
|
|
@@ -96,7 +86,7 @@ def analyze_file(uploaded_file):
|
|
| 96 |
|
| 97 |
|
| 98 |
# Streamlit Interface
|
| 99 |
-
st.title("Data Analysis
|
| 100 |
st.write("Upload a CSV or Excel file to analyze the antenna data and get insights.")
|
| 101 |
|
| 102 |
# File upload
|
|
@@ -106,14 +96,12 @@ if uploaded_file is not None:
|
|
| 106 |
results = analyze_file(uploaded_file)
|
| 107 |
|
| 108 |
if isinstance(results, tuple): # If it's a valid result (tuple)
|
| 109 |
-
mean_gain, median_gain, std_dev_gain,
|
| 110 |
|
| 111 |
st.write(f"Mean Gain: {mean_gain}")
|
| 112 |
st.write(f"Median Gain: {median_gain}")
|
| 113 |
st.write(f"Standard Deviation of Gain: {std_dev_gain}")
|
| 114 |
|
| 115 |
-
st.pyplot(fig) # Show plot
|
| 116 |
-
|
| 117 |
st.write("Groq's Analysis:")
|
| 118 |
st.write(groq_analysis)
|
| 119 |
else:
|
|
|
|
| 1 |
import os
|
| 2 |
import pandas as pd
|
| 3 |
import numpy as np
|
|
|
|
| 4 |
import streamlit as st
|
| 5 |
import requests
|
| 6 |
|
|
|
|
| 52 |
st.write(f"Median Gain: {median_gain}")
|
| 53 |
st.write(f"Standard Deviation of Gain: {std_dev_gain}")
|
| 54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
# Send summary to Groq API for analysis
|
| 56 |
data_summary = f"""
|
| 57 |
The dataset contains simulation results for antennas. The frequency range is from 1 GHz to 10 GHz.
|
|
|
|
| 86 |
|
| 87 |
|
| 88 |
# Streamlit Interface
|
| 89 |
+
st.title("Data Analysis with Groq API")
|
| 90 |
st.write("Upload a CSV or Excel file to analyze the antenna data and get insights.")
|
| 91 |
|
| 92 |
# File upload
|
|
|
|
| 96 |
results = analyze_file(uploaded_file)
|
| 97 |
|
| 98 |
if isinstance(results, tuple): # If it's a valid result (tuple)
|
| 99 |
+
mean_gain, median_gain, std_dev_gain, groq_analysis = results
|
| 100 |
|
| 101 |
st.write(f"Mean Gain: {mean_gain}")
|
| 102 |
st.write(f"Median Gain: {median_gain}")
|
| 103 |
st.write(f"Standard Deviation of Gain: {std_dev_gain}")
|
| 104 |
|
|
|
|
|
|
|
| 105 |
st.write("Groq's Analysis:")
|
| 106 |
st.write(groq_analysis)
|
| 107 |
else:
|