Spaces:
Build error
Build error
Commit History
-
requirements.txt
Verified signaturegradio networkx numpy matplotlibf9f2ade -
app.py
Verified signatureimport gradio as gr import numpy as np import matplotlib.pyplot as plt import networkx as nx # Helper Functions def parse_graph_input(graph_input): """Parse user input to create an adjacency list.""" try: # Try interpreting as a dictionary (adjacency list) graph = eval(graph_input) if isinstance(graph, dict): return graph except: pass try: # Try interpreting as an edge list edges = eval(graph_input) if not isinstance(edges, list): raise ValueError("Invalid graph input. Please use an adjacency list or edge list.") graph = {} for u, v in edges: graph.setdefault(u, []).append(v) graph.setdefault(v, []).append(u) return graph except: raise ValueError("Invalid graph input. Please use a valid adjacency list or edge list.") def visualize_graph(graph): """Generate a visualization of the graph using a circular layout.""" …c4cc609 -
app.py
Verified signatureimport subprocess import sys # List of required packages required_packages = [ 'matplotlib', 'networkx', 'numpy', 'scipy', 'pandas', # Add more packages if necessary ] # Install packages for package in required_packages: subprocess.check_call([sys.executable, "-m", "pip", "install", package]) # Now you can safely import them import matplotlib.pyplot as plt import networkx as nx import numpy as np import pandas as pd import scipy # Example Code for Matplotlib and Networkx (Modify this as needed) # Let's create a simple graph using networkx and plot it using matplotlib # Create a graph G = nx.Graph() # Add some nodes and edges G.add_node(1) G.add_node(2) G.add_node(3) G.add_edge(1, 2) G.add_edge(2, 3) # Draw the graph nx.draw(G, with_labels=True, font_weight='bold') plt.title("Simple NetworkX Graph") plt.show() # Example for using NumPy and Pandas data = np.array([1, 2, 3, 4, 5]) df = pd.DataFrame(data, columns=["Numbers"]) print("Data in DataFrame:\n"…6b29440 -
initial commit
Verified signature5514b4f