AUXteam commited on
Commit
e6db76d
·
verified ·
1 Parent(s): bd75c53

Upload folder using huggingface_hub

Browse files
components/ChatPage.tsx CHANGED
@@ -151,10 +151,11 @@ const ChatPage: React.FC<ChatPageProps> = ({ onBack, simulationResult, setSimula
151
  const fetchSimulations = async () => {
152
  try {
153
  const sims = await GradioService.listSimulations();
154
- if (sims && sims.length > 0) {
155
- // If sims is an array of objects or strings, pick the first one
156
- const firstSim = typeof sims[0] === 'string' ? sims[0] : (sims[0].id || sims[0].name || 'User Group 1');
157
- setSimulationId(firstSim);
 
158
  }
159
  } catch (e) {
160
  console.error("Failed to fetch simulations:", e);
 
151
  const fetchSimulations = async () => {
152
  try {
153
  const sims = await GradioService.listSimulations();
154
+ if (Array.isArray(sims) && sims.length > 0) {
155
+ const firstSim = typeof sims[0] === 'string' ? sims[0] : (sims[0].id || sims[0].name || '');
156
+ if (firstSim) {
157
+ setSimulationId(firstSim);
158
+ }
159
  }
160
  } catch (e) {
161
  console.error("Failed to fetch simulations:", e);
components/SimulationGraph.tsx CHANGED
@@ -22,7 +22,8 @@ const SimulationGraph: React.FC<SimulationGraphProps> = ({ isBuilding, societyTy
22
  if (!graphDiv.current || isBuilding) return;
23
 
24
  // --- Dynamic Data Generation based on Society Type ---
25
- const isTech = societyType.includes('Tech') || societyType.includes('Founders');
 
26
 
27
  const N = isTech ? 120 : 80;
28
  const radius = isTech ? 0.18 : 0.22;
 
22
  if (!graphDiv.current || isBuilding) return;
23
 
24
  // --- Dynamic Data Generation based on Society Type ---
25
+ const safeSocietyType = typeof societyType === 'string' ? societyType : '';
26
+ const isTech = safeSocietyType.includes('Tech') || safeSocietyType.includes('Founders');
27
 
28
  const N = isTech ? 120 : 80;
29
  const radius = isTech ? 0.18 : 0.22;
components/SimulationPage.tsx CHANGED
@@ -68,11 +68,16 @@ const SimulationPage: React.FC<SimulationPageProps> = ({
68
  const fetchSocieties = async () => {
69
  try {
70
  const list = await GradioService.listSimulations();
71
- if (list && list.length > 0) {
72
- const names = list.map((s: any) => typeof s === 'string' ? s : (s.id || s.name));
73
- setSocieties(names);
74
- if (!names.includes(society)) {
75
- setSociety(names[0]);
 
 
 
 
 
76
  }
77
  }
78
  } catch (e) {
 
68
  const fetchSocieties = async () => {
69
  try {
70
  const list = await GradioService.listSimulations();
71
+ if (Array.isArray(list) && list.length > 0) {
72
+ const names = list
73
+ .map((s: any) => typeof s === 'string' ? s : (s.id || s.name || ''))
74
+ .filter(name => typeof name === 'string' && name.length > 0);
75
+
76
+ if (names.length > 0) {
77
+ setSocieties(names);
78
+ if (!names.includes(society)) {
79
+ setSociety(names[0]);
80
+ }
81
  }
82
  }
83
  } catch (e) {
debug_black_screen.mjs ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import { chromium } from 'playwright';
3
+
4
+ (async () => {
5
+ const browser = await chromium.launch();
6
+ const page = await browser.newPage();
7
+
8
+ page.on('console', msg => console.log('BROWSER LOG:', msg.text()));
9
+ page.on('pageerror', err => console.log('BROWSER ERROR:', err.message));
10
+
11
+ try {
12
+ console.log('Navigating to the app...');
13
+ await page.goto('https://auxteam-usersyncinterface.hf.space');
14
+
15
+ console.log('Waiting 1 second...');
16
+ await page.waitForTimeout(1000);
17
+ await page.screenshot({ path: 'verification/black_screen_1s.png' });
18
+
19
+ console.log('Waiting 3 seconds...');
20
+ await page.waitForTimeout(3000);
21
+ await page.screenshot({ path: 'verification/black_screen_4s.png' });
22
+
23
+ console.log('Waiting 5 more seconds...');
24
+ await page.waitForTimeout(5000);
25
+ await page.screenshot({ path: 'verification/black_screen_9s.png' });
26
+
27
+ const bodyContent = await page.evaluate(() => document.body.innerHTML);
28
+ console.log('Body content length:', bodyContent.length);
29
+
30
+ } catch (error) {
31
+ console.error('Verification failed:', error);
32
+ } finally {
33
+ await browser.close();
34
+ }
35
+ })();
debug_black_screen.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ from playwright.sync_api import sync_playwright
3
+ import time
4
+
5
+ def verify():
6
+ with sync_playwright() as p:
7
+ browser = p.chromium.launch(headless=True)
8
+ context = browser.new_context(viewport={'width': 1280, 'height': 720})
9
+ page = context.new_page()
10
+
11
+ page.on('console', lambda msg: print(f'BROWSER LOG: {msg.text}'))
12
+ page.on('pageerror', lambda err: print(f'BROWSER ERROR: {err}'))
13
+
14
+ print("Navigating to HF Space...")
15
+ page.goto('https://auxteam-usersyncinterface.hf.space')
16
+
17
+ print("Wait 1s")
18
+ time.sleep(1)
19
+ page.screenshot(path='/home/jules/verification/black_1s.png')
20
+
21
+ print("Wait 3s")
22
+ time.sleep(3)
23
+ page.screenshot(path='/home/jules/verification/black_4s.png')
24
+
25
+ print("Wait 5s")
26
+ time.sleep(5)
27
+ page.screenshot(path='/home/jules/verification/black_9s.png')
28
+
29
+ browser.close()
30
+
31
+ if __name__ == "__main__":
32
+ verify()
services/gradioService.ts CHANGED
@@ -16,7 +16,7 @@ export class GradioService {
16
  try {
17
  const client = await this.getClient();
18
  const result = await client.predict("/identify_personas", [context]);
19
- return result.data;
20
  } catch (error) {
21
  console.error("Error identifying personas:", error);
22
  throw error;
@@ -27,7 +27,7 @@ export class GradioService {
27
  try {
28
  const client = await this.getClient();
29
  const result = await client.predict("/start_simulation_async", [simulationId, contentText, format]);
30
- return result.data;
31
  } catch (error) {
32
  console.error("Error starting simulation:", error);
33
  throw error;
@@ -38,7 +38,7 @@ export class GradioService {
38
  try {
39
  const client = await this.getClient();
40
  const result = await client.predict("/get_simulation_status", [simulationId]);
41
- return result.data;
42
  } catch (error) {
43
  console.error("Error getting simulation status:", error);
44
  throw error;
@@ -49,7 +49,7 @@ export class GradioService {
49
  try {
50
  const client = await this.getClient();
51
  const result = await client.predict("/generate_variants", [contentText, numVariants]);
52
- return result.data;
53
  } catch (error) {
54
  console.error("Error generating variants:", error);
55
  return ["Unable to generate variants at this time."];
@@ -60,7 +60,7 @@ export class GradioService {
60
  try {
61
  const client = await this.getClient();
62
  const result = await client.predict("/list_simulations", []);
63
- return result.data;
64
  } catch (error) {
65
  console.error("Error listing simulations:", error);
66
  return [];
 
16
  try {
17
  const client = await this.getClient();
18
  const result = await client.predict("/identify_personas", [context]);
19
+ return result.data[0];
20
  } catch (error) {
21
  console.error("Error identifying personas:", error);
22
  throw error;
 
27
  try {
28
  const client = await this.getClient();
29
  const result = await client.predict("/start_simulation_async", [simulationId, contentText, format]);
30
+ return result.data[0];
31
  } catch (error) {
32
  console.error("Error starting simulation:", error);
33
  throw error;
 
38
  try {
39
  const client = await this.getClient();
40
  const result = await client.predict("/get_simulation_status", [simulationId]);
41
+ return result.data[0];
42
  } catch (error) {
43
  console.error("Error getting simulation status:", error);
44
  throw error;
 
49
  try {
50
  const client = await this.getClient();
51
  const result = await client.predict("/generate_variants", [contentText, numVariants]);
52
+ return result.data[0];
53
  } catch (error) {
54
  console.error("Error generating variants:", error);
55
  return ["Unable to generate variants at this time."];
 
60
  try {
61
  const client = await this.getClient();
62
  const result = await client.predict("/list_simulations", []);
63
+ return result.data[0];
64
  } catch (error) {
65
  console.error("Error listing simulations:", error);
66
  return [];