BoltzmannEntropy commited on
Commit
4cf69d5
·
1 Parent(s): 24e893f
Files changed (1) hide show
  1. app.py +17 -6
app.py CHANGED
@@ -14,13 +14,26 @@ import pennylane as qml
14
  dev = qml.device('default.qubit', wires=10)
15
 
16
  # Hugging Face and DuckDB function placeholders
 
 
17
  def store_in_hf_dataset(data):
18
- # Implement storing data in the Hugging Face dataset
19
- pass
 
 
 
 
 
 
 
 
 
 
20
 
21
  def load_from_hf_dataset():
22
- # Implement loading data from the Hugging Face dataset
23
- return []
 
24
 
25
  # Function to buffer the plot and return as PIL image
26
  def buffer_plot_and_get(fig):
@@ -146,7 +159,6 @@ def load_results(load_from_hf_checkbox, load_from_duckdb_checkbox):
146
  if load_from_duckdb_checkbox:
147
  return load_from_duckdb() # Load from DuckDB
148
 
149
- # Gradio app
150
  # Gradio app
151
  with gr.Blocks() as app:
152
  gr.Markdown("# Quantum Hamiltonian Generator")
@@ -193,5 +205,4 @@ with gr.Blocks() as app:
193
 
194
  load_button.click(load_results, inputs=[load_option], outputs=output_display)
195
 
196
-
197
  app.launch(share=True)
 
14
  dev = qml.device('default.qubit', wires=10)
15
 
16
  # Hugging Face and DuckDB function placeholders
17
+ from datasets import load_dataset, Dataset
18
+
19
  def store_in_hf_dataset(data):
20
+ # Convert data to Hugging Face Dataset format
21
+ dataset = Dataset.from_dict({
22
+ 'id': [item[0] for item in data],
23
+ 'hamiltonian': [item[2] for item in data],
24
+ 'qasm_code': [item[3] for item in data],
25
+ 'trotter_code': [item[4] for item in data],
26
+ 'num_qubits': [item[5] for item in data],
27
+ 'trotter_order': [item[6] for item in data],
28
+ 'timestamp': [str(item[7]) for item in data],
29
+ })
30
+ # Push to Hugging Face dataset hub (replace with your dataset path)
31
+ dataset.push_to_hub("your-username/BoltzmannEntropy-QuantumLLMInstruct")
32
 
33
  def load_from_hf_dataset():
34
+ # Load from Hugging Face dataset
35
+ dataset = load_dataset("your-username/BoltzmannEntropy-QuantumLLMInstruct")
36
+ return dataset
37
 
38
  # Function to buffer the plot and return as PIL image
39
  def buffer_plot_and_get(fig):
 
159
  if load_from_duckdb_checkbox:
160
  return load_from_duckdb() # Load from DuckDB
161
 
 
162
  # Gradio app
163
  with gr.Blocks() as app:
164
  gr.Markdown("# Quantum Hamiltonian Generator")
 
205
 
206
  load_button.click(load_results, inputs=[load_option], outputs=output_display)
207
 
 
208
  app.launch(share=True)