Add gradio local inference demo

This commit is contained in:
ainsley
2025-10-24 06:11:35 -07:00
committed by Will Lin
parent 50da62e722
commit 5ae4be820b
7 changed files with 1505 additions and 0 deletions
+680
View File
@@ -0,0 +1,680 @@
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="100%" viewBox="0 0 1256 520" enable-background="new 0 0 1256 520" xml:space="preserve">
<path fill="#000000" opacity="1.000000" stroke="none"
d="
M1257.000000,370.000000
C1257.000000,420.315582 1257.000000,470.631195 1257.000000,521.000000
C907.974182,521.000000 558.948364,521.000000 209.130188,520.765869
C211.594635,516.820618 214.783417,513.046997 218.121536,509.410461
C226.497818,500.285522 234.935486,491.216888 243.359863,482.136169
C256.276855,468.212769 269.207367,454.301880 282.124329,440.378448
C290.548889,431.297485 298.953308,422.197906 307.377899,413.116974
C320.297028,399.191345 333.229889,385.278442 346.148956,371.352753
C354.573517,362.271820 362.958649,353.154236 371.406372,344.094940
C385.723633,328.741211 400.063049,313.408081 414.420563,298.092010
C420.420868,291.691040 426.517273,285.380066 432.502533,278.965240
C433.432526,277.968536 434.000427,276.633972 435.103424,274.866486
C404.924042,274.866486 375.476227,274.866486 346.143494,274.555603
C351.566467,267.604675 356.904388,260.988403 362.175903,254.319656
C373.224121,240.343063 384.414642,226.473373 395.184967,212.285187
C400.060760,205.862137 405.103760,202.516434 413.978210,202.714035
C446.457245,203.437195 478.962128,203.000336 511.457275,203.000336
C513.236572,203.000336 515.015869,203.000336 517.007996,203.000336
C517.007996,204.755783 516.861755,205.932083 517.030701,207.061218
C518.648193,217.872177 521.072693,228.632385 521.689392,239.496628
C522.054626,245.931732 524.694336,246.119980 529.582703,246.077759
C550.578003,245.896301 571.575745,246.000336 592.572632,246.000336
C594.331909,246.000336 596.091187,246.000336 597.841919,246.000336
C597.178528,240.348862 596.599609,235.326508 595.997559,230.306931
C594.925537,221.368286 593.892456,212.424530 592.744751,203.495560
C591.557556,194.260101 590.193054,185.047348 589.017456,175.810501
C587.859863,166.716110 586.888184,157.598160 585.749878,148.501175
C584.552551,138.932785 583.210022,129.382584 582.012939,119.814186
C580.874878,110.717094 579.889282,101.600929 578.750977,92.503876
C577.553650,82.935524 576.210022,73.385490 575.013000,63.817116
C573.874878,54.719952 572.890564,45.603550 571.752258,36.506416
C570.554993,26.938486 568.991577,17.406889 568.135681,7.810584
C567.812683,4.189710 566.954163,2.913547 563.217590,2.931406
C536.388855,3.059636 509.558716,2.931014 482.730927,3.133805
C480.633331,3.149660 478.158264,4.655246 476.553345,6.193340
C474.230652,8.419254 472.548004,11.311471 470.582916,13.912311
C463.008911,23.936728 455.431122,33.958309 447.542053,44.114792
C445.576691,46.266914 443.856262,48.233826 442.282043,50.311539
C428.925568,67.939987 415.704590,85.672318 402.228912,103.208984
C387.042633,122.971779 371.535828,142.488312 356.351807,162.252823
C342.878021,179.791153 329.768005,197.608963 316.291901,215.145493
C301.104584,234.908875 285.617371,254.441574 270.389893,274.174438
C255.179794,293.884796 240.120148,313.711304 225.017456,333.504395
C222.013229,337.441650 219.112671,341.457977 215.624405,346.166626
C239.778122,346.166626 262.889130,346.166626 285.869019,346.467285
C277.049896,356.457672 268.289612,366.083740 259.691833,375.852875
C248.504379,388.564545 237.429550,401.375580 226.338791,414.172028
C220.315491,421.121704 214.420776,428.183533 208.351959,435.092773
C204.268433,439.741760 199.981659,444.212219 195.280121,449.310944
C193.769485,436.741760 192.489594,425.076019 190.938217,413.446533
C189.081894,399.531067 186.881424,385.661407 185.037476,371.744415
C183.211319,357.961792 181.738541,344.132507 179.938034,330.346252
C177.717316,313.342499 175.257294,296.369965 173.050140,279.364532
C172.635040,276.166321 171.501968,274.899902 168.093628,274.928345
C149.936005,275.080048 131.776428,274.994995 113.617546,275.008514
C112.153008,275.009583 110.688568,275.136261 108.959923,275.216919
C119.158012,353.263641 129.313751,430.986267 139.529221,509.166077
C163.410370,509.166077 187.204910,509.166077 210.990295,509.534637
C209.320786,513.602112 207.660385,517.301086 206.000000,521.000000
C137.679260,521.000000 69.358528,521.000000 1.018897,521.000000
C1.018897,347.711212 1.018897,174.422440 1.018897,1.066829
C419.544922,1.066829 838.089844,1.066829 1257.000000,1.066829
C1257.000000,104.692207 1257.000000,208.384842 1256.737427,312.869263
C1255.971558,313.045929 1255.286499,312.507141 1254.991577,311.804535
C1247.915283,294.942474 1233.968628,286.122437 1217.661255,280.358765
C1199.713379,274.015320 1180.845581,273.097626 1162.082275,272.117340
C1154.692261,271.731232 1147.218872,272.476776 1139.809326,273.043823
C1129.018921,273.869598 1118.177124,274.503937 1107.491943,276.114410
C1090.721680,278.642090 1074.744019,283.756622 1059.728027,291.967438
C1039.338379,303.116699 1024.153198,319.321136 1014.245056,339.945923
C1006.890686,355.254822 1000.987122,371.333008 995.412659,387.406799
C988.077942,408.556519 981.530457,429.946716 984.926147,452.968536
C987.300415,469.065430 994.814148,481.835846 1008.141052,490.975098
C1026.500610,503.565613 1047.716064,507.760803 1069.234253,508.722046
C1094.076050,509.831726 1118.996460,509.814636 1143.619995,504.145660
C1171.041260,497.832581 1195.487915,486.766418 1214.930176,465.713074
C1227.220459,452.404297 1236.384644,437.293976 1241.856079,420.227600
C1246.947388,404.347198 1250.657471,388.024872 1255.063599,371.921204
C1255.271606,371.161133 1256.335083,370.635101 1257.000000,370.000000
M678.600220,493.070221
C701.167419,481.263275 716.963379,462.884735 728.992737,440.921509
C738.246033,424.026733 744.482483,405.922516 750.006226,387.543335
C756.183655,366.989105 760.375366,346.174286 756.940918,324.625397
C753.937927,305.783936 743.820618,291.707031 726.606506,283.370209
C714.399414,277.458313 700.992065,275.272400 687.638855,275.158752
C639.987305,274.753143 592.330200,275.022461 544.675415,274.943237
C541.865234,274.938568 540.727051,275.906403 539.922852,278.556061
C536.437988,290.037750 532.646729,301.425995 529.070496,312.880585
C522.206543,334.865845 515.467041,356.889984 508.577881,378.867279
C497.081329,415.542999 485.504913,452.193695 473.968964,488.857086
C471.907806,495.407806 469.880035,501.969025 467.688934,509.000000
C470.298859,509.000000 472.118591,509.000000 473.938293,509.000000
C520.926758,509.000000 567.915283,509.025421 614.903625,508.957092
C619.165588,508.950897 623.424805,508.314484 627.688477,508.017548
C645.492554,506.777588 662.140625,501.540405 678.600220,493.070221
M793.441833,232.039444
C803.065491,224.640015 810.373962,215.261902 817.277283,205.352859
C833.968140,181.395111 840.006104,155.160141 833.799072,126.717125
C830.588196,112.003365 820.459839,99.752991 800.658752,99.929565
C770.497498,100.198517 740.332031,100.028206 710.168457,99.982201
C701.468933,99.968933 696.617004,95.942009 693.653809,89.214081
C690.721436,82.556221 692.502563,74.310760 697.768982,69.592628
C702.076660,65.733345 706.947876,64.035820 712.486328,64.026688
C745.149597,63.972855 777.812988,64.000107 810.476379,64.000069
C822.464233,64.000053 834.452026,64.000061 846.406372,64.000061
C854.915283,43.633976 863.332520,23.487314 871.826111,3.157861
C870.765320,3.078329 870.268188,3.008459 869.770996,3.008404
C813.443359,3.002246 757.115662,3.001117 700.788025,3.001681
C699.955078,3.001690 699.099670,2.906274 698.292419,3.057026
C677.691833,6.904143 661.873291,17.945644 649.579834,34.740677
C640.117188,47.668446 633.293518,61.812450 629.477356,77.237671
C625.143311,94.756310 623.682068,112.351700 629.846619,130.024963
C634.617493,143.702713 646.498718,151.988037 660.572937,151.997971
C674.571533,152.007858 688.570129,152.000137 702.568726,152.000137
C721.066833,152.000137 739.565002,151.982727 758.063110,152.010178
C764.042175,152.019043 766.547607,154.861893 767.069641,160.637299
C768.272766,173.947617 753.268799,187.346725 741.019531,187.188843
C701.530029,186.679871 662.029968,186.998978 622.533936,186.998886
C620.743530,186.998871 618.953064,186.998871 617.035889,186.998871
C619.371887,206.981918 621.642456,226.405136 623.933044,246.000153
C626.445557,246.000153 628.263245,246.000168 630.080933,246.000168
C666.410583,246.000168 702.740356,246.037460 739.069824,245.956238
C744.000305,245.945221 748.925598,245.143219 753.859863,245.048050
C768.150085,244.772354 780.959839,240.012787 793.441833,232.039444
M823.500000,509.000000
C859.832458,509.000000 896.164978,508.963348 932.497131,509.061859
C935.796997,509.070801 937.142883,508.180389 938.220764,504.799927
C941.372803,494.913971 945.313660,485.282684 948.766968,475.488617
C951.587891,467.488007 954.152283,459.396942 956.950256,450.985413
C909.475220,450.985413 862.513733,450.985413 815.273376,450.985413
C818.665588,439.851044 821.967529,429.012909 825.322754,418.000000
C827.376160,418.000000 829.196228,418.000000 831.016357,418.000000
C861.182373,418.000000 891.350220,417.838135 921.512695,418.164948
C926.342529,418.217316 928.313965,416.227722 929.828918,412.466583
C933.588440,403.132904 937.380371,393.812286 941.143860,384.480194
C943.548706,378.517181 945.926086,372.543091 948.562500,365.957397
C912.649841,365.957397 877.591187,365.957397 842.244995,365.957397
C844.935669,356.628937 847.589722,347.760406 850.023315,338.831787
C851.043762,335.088165 852.912659,333.865448 856.982178,333.882568
C901.480469,334.069885 945.980225,333.913422 990.478210,334.131104
C995.026306,334.153351 996.649048,332.352051 998.076538,328.587341
C1000.952820,321.001373 1004.289795,313.590240 1007.430237,306.104218
C1011.685791,295.960175 1015.935242,285.813599 1020.467407,274.999756
C1017.769348,274.999756 1015.825684,274.999756 1013.882019,274.999756
C946.716736,274.999756 879.551208,275.080597 812.386719,274.849823
C806.877380,274.830902 804.631836,276.188446 802.924622,281.590912
C792.265320,315.321655 781.134277,348.903381 770.154907,382.532990
C759.125549,416.316254 748.085510,450.096100 737.062195,483.881348
C734.374329,492.119171 731.733032,500.372131 728.947021,509.000000
C760.521301,509.000000 791.510620,509.000000 823.500000,509.000000
M324.061890,146.652771
C334.478180,132.387604 344.894440,118.122437 356.073273,102.812965
C311.480286,102.812965 268.317383,102.812965 224.377686,102.812965
C228.362366,90.856155 232.333740,79.710640 235.701431,68.385605
C236.776581,64.770020 238.291229,63.918194 241.799362,63.926212
C289.787842,64.035896 337.777008,63.927029 385.764923,64.125465
C390.047546,64.143181 392.615631,62.465302 394.886719,59.444019
C402.725250,49.016335 410.504120,38.543591 418.379639,28.143984
C424.546509,20.000668 430.822906,11.940317 437.464386,3.305126
C352.701477,3.305126 268.662537,3.305126 184.356949,3.305126
C159.018921,84.013359 133.637527,164.859695 108.215561,245.835236
C133.651245,245.835236 158.622452,245.835236 183.817520,245.835236
C191.742508,216.528183 199.641541,187.317169 207.569260,158.000061
C239.271423,158.000061 270.762512,157.627304 302.235352,158.221146
C312.015503,158.405701 319.677765,156.987640 324.061890,146.652771
M1108.470703,39.029751
C1113.018921,27.177361 1117.567139,15.324969 1122.225952,3.184111
C1120.789185,3.089758 1120.129761,3.008600 1119.470459,3.008539
C1046.973022,3.001799 974.475464,3.048127 901.978455,2.878727
C897.802551,2.868970 897.112732,5.407640 896.085999,8.005063
C892.151001,17.960417 888.367798,27.975712 884.515625,37.963902
C881.261475,46.401470 877.990295,54.832458 874.435608,64.018448
C900.747009,64.018448 926.276794,64.018448 952.406921,64.018448
C933.489685,125.011124 914.785645,185.316513 896.004700,245.869720
C919.482300,245.869720 942.456970,245.869720 965.591064,245.869720
C973.080383,221.650253 980.504333,197.491135 988.023621,173.361771
C998.929321,138.365265 1009.984070,103.414841 1020.728271,68.369057
C1021.835510,64.757309 1023.333557,63.902576 1026.824463,63.925091
C1049.489380,64.071274 1072.155884,64.040337 1094.821045,63.919090
C1096.526978,63.909969 1099.284424,63.189693 1099.757446,62.052822
C1102.807251,54.723213 1105.357056,47.185581 1108.470703,39.029751
M427.075409,332.690796
C422.485901,346.896729 417.932861,361.114594 413.299713,375.306274
C401.968536,410.014343 390.597931,444.709503 379.248596,479.411591
C376.082092,489.093536 372.934265,498.781586 369.605469,508.995850
C393.401093,508.995850 416.546112,509.034119 439.689850,508.878876
C440.806915,508.871368 442.522949,507.367523 442.916718,506.206573
C444.529694,501.451294 445.644867,496.530426 447.109985,491.721252
C458.027954,455.883942 469.064331,420.082458 479.905182,384.221863
C488.071899,357.207062 495.997742,330.119476 504.044037,303.068268
C506.764557,293.921906 509.525726,284.787659 512.292480,275.567169
C511.357513,275.296814 510.900421,275.049622 510.442963,275.048981
C489.944061,275.019318 469.444519,274.950195 448.947510,275.142670
C447.627594,275.155060 445.594910,276.959686 445.128143,278.346130
C439.121582,296.186249 433.339813,314.102020 427.075409,332.690796
M137.999939,37.503254
C131.554260,58.247139 125.184052,79.014847 118.646225,99.729652
C107.181030,136.056595 95.586159,172.342590 84.103249,208.663971
C80.250046,220.851959 76.572350,233.095428 72.690941,245.715027
C81.276062,245.715027 89.355797,245.715027 97.634827,245.715027
C122.994667,164.960953 148.378799,84.129539 173.856400,3.000472
C166.385803,3.000472 159.393219,3.098789 152.405807,2.951648
C149.645508,2.893522 148.458282,3.742993 147.631958,6.567070
C144.674210,16.675442 141.295288,26.660570 137.999939,37.503254
M76.926239,299.824615
C77.284218,303.584808 77.575737,307.352753 78.013512,311.103638
C79.037918,319.880798 80.064041,328.658783 81.215462,337.419830
C82.747688,349.078339 84.435532,360.716309 85.988327,372.372192
C87.154549,381.126373 88.181999,389.898987 89.328629,398.655884
C90.516373,407.726776 91.813423,416.783386 92.988594,425.855835
C94.144417,434.778961 95.154007,443.721130 96.324249,452.642273
C97.832642,464.141266 99.433640,475.628082 101.001320,487.119263
C101.987190,494.345764 102.985077,501.570618 103.984673,508.847900
C112.528656,508.847900 120.492012,508.847900 128.620285,508.847900
C118.422234,430.833038 108.246529,352.989197 98.111282,275.454834
C89.451981,275.454834 81.571190,275.454834 73.368988,275.454834
C74.461586,283.635040 75.488724,291.325104 76.926239,299.824615
M53.496017,235.003586
C56.637707,225.113220 59.832245,215.239258 62.910313,205.329132
C69.742783,183.331375 76.416466,161.283859 83.337395,139.314133
C94.789261,102.961411 106.405334,66.660454 117.905869,30.323011
C120.728195,21.405510 123.371277,12.431283 126.243896,3.000076
C123.203484,3.000076 120.681496,3.289421 118.253426,2.935123
C114.181557,2.340968 112.558449,4.066622 111.460510,7.876744
C107.688278,20.967325 103.590233,33.965286 99.522072,46.969044
C92.209694,70.342781 84.829094,93.695175 77.476776,117.056412
C68.323456,146.140152 59.172226,175.224564 50.015446,204.307205
C45.688026,218.051437 41.349781,231.792267 36.871075,245.995621
C40.769463,245.995621 44.255535,246.181259 47.701450,245.890671
C48.842243,245.794510 50.431515,244.698212 50.855000,243.665298
C51.892857,241.133865 52.371040,238.372971 53.496017,235.003586
M72.011253,441.277130
C71.341072,435.759125 70.649132,430.243622 70.005669,424.722504
C68.963661,415.781616 68.054939,406.823975 66.904999,397.897217
C65.361946,385.918884 63.601089,373.968781 62.013474,361.995972
C60.895794,353.567078 59.969955,345.112701 58.852421,336.683777
C57.286518,324.873077 55.602306,313.078064 54.006241,301.271301
C52.831028,292.577728 51.715908,283.876038 50.578835,275.214722
C46.331650,275.214722 42.386536,275.214722 37.699081,275.214722
C47.891350,353.189117 58.043629,430.857574 68.225517,508.752563
C72.438980,508.752563 76.519943,508.752563 80.953033,508.752563
C80.235046,502.239197 79.631248,495.940033 78.827858,489.666412
C77.625465,480.277039 76.316200,470.900909 74.988213,461.528229
C74.073578,455.072845 73.050293,448.632874 72.011253,441.277130
M25.999325,194.513199
C29.105597,184.442337 32.148888,174.351547 35.329453,164.304214
C46.827457,127.982246 58.408974,91.686684 69.881874,55.356815
C75.244125,38.376793 80.430092,21.341099 85.692398,4.342134
C80.699463,3.104707 78.321388,4.526131 76.813156,9.747686
C71.100830,29.523956 64.806946,49.133678 58.627193,68.773163
C49.528023,97.690689 40.332436,126.577866 31.192583,155.482605
C22.589426,182.690063 13.992743,209.899582 5.437377,237.122086
C4.779933,239.214020 4.472698,241.416031 3.955338,243.783524
C6.525373,243.783524 8.633832,243.783524 10.517684,243.783524
C15.707582,227.457230 20.814678,211.391403 25.999325,194.513199
M27.998537,407.642303
C27.665359,405.382477 27.295940,403.127258 27.005978,400.861908
C26.217030,394.698151 25.506033,388.524200 24.682487,382.365173
C23.492712,373.467224 22.186155,364.584747 21.012688,355.684692
C19.858631,346.931824 18.848600,338.159973 17.701656,329.406128
C16.513916,320.340912 15.225304,311.288910 14.003654,302.228088
C12.874923,293.856415 11.776448,285.480652 10.679947,277.221924
C8.315143,277.221924 6.365981,277.221924 3.817110,277.221924
C13.903301,354.330780 23.950878,431.144440 33.949539,507.584167
C36.839798,507.584167 38.873970,507.584167 40.778835,507.584167
C40.405422,503.938446 40.159004,500.685425 39.725979,497.457397
C38.184998,485.970062 36.541531,474.496460 35.012585,463.007568
C33.826576,454.095581 32.771866,445.166229 31.625261,436.248871
C30.437838,427.014008 29.209997,417.784271 27.998537,407.642303
z"/>
<path fill="#356CFF" opacity="1.000000" stroke="none"
d="
M1257.000000,369.531372
C1256.335083,370.635101 1255.271606,371.161133 1255.063599,371.921204
C1250.657471,388.024872 1246.947388,404.347198 1241.856079,420.227600
C1236.384644,437.293976 1227.220459,452.404297 1214.930176,465.713074
C1195.487915,486.766418 1171.041260,497.832581 1143.619995,504.145660
C1118.996460,509.814636 1094.076050,509.831726 1069.234253,508.722046
C1047.716064,507.760803 1026.500610,503.565613 1008.141052,490.975098
C994.814148,481.835846 987.300415,469.065430 984.926147,452.968536
C981.530457,429.946716 988.077942,408.556519 995.412659,387.406799
C1000.987122,371.333008 1006.890686,355.254822 1014.245056,339.945923
C1024.153198,319.321136 1039.338379,303.116699 1059.728027,291.967438
C1074.744019,283.756622 1090.721680,278.642090 1107.491943,276.114410
C1118.177124,274.503937 1129.018921,273.869598 1139.809326,273.043823
C1147.218872,272.476776 1154.692261,271.731232 1162.082275,272.117340
C1180.845581,273.097626 1199.713379,274.015320 1217.661255,280.358765
C1233.968628,286.122437 1247.915283,294.942474 1254.991577,311.804535
C1255.286499,312.507141 1255.971558,313.045929 1256.737427,313.330505
C1257.000000,331.687561 1257.000000,350.375122 1257.000000,369.531372
M1050.998413,424.449554
C1051.867676,430.512054 1053.834106,435.917755 1058.059937,440.707397
C1066.987549,450.825684 1078.980225,453.255829 1091.273560,453.778687
C1101.244751,454.202789 1111.361816,453.159821 1121.302490,451.891510
C1137.213867,449.861359 1151.305054,443.177185 1163.065063,432.310730
C1177.084961,419.355957 1184.383545,402.539856 1189.004272,384.367889
C1191.473145,374.657928 1194.271362,364.900970 1192.819580,354.825134
C1192.202637,350.543091 1190.452393,345.854401 1187.750000,342.550415
C1179.896606,332.948700 1168.062378,331.749451 1156.973755,331.286560
C1143.843872,330.738434 1130.515137,331.502991 1117.471558,333.214355
C1101.664917,335.288361 1087.608887,342.052185 1076.058838,353.430695
C1062.766113,366.525848 1056.119873,383.108765 1052.220459,400.782074
C1050.603760,408.110260 1051.327148,415.954803 1050.998413,424.449554
z"/>
<path fill="#FDC717" opacity="1.000000" stroke="none"
d="
M206.375000,521.000000
C207.660385,517.301086 209.320786,513.602112 211.328003,509.403809
C212.157883,508.251556 212.767105,507.657990 213.105774,506.937317
C225.069077,481.478790 236.974380,455.992981 248.958710,430.544403
C258.618896,410.031128 268.377380,389.564148 278.077423,369.069611
C281.641479,361.539429 285.163147,353.989136 288.836304,346.166626
C287.611328,346.166626 286.805725,346.166626 286.000122,346.166626
C262.889130,346.166626 239.778122,346.166626 215.624405,346.166626
C219.112671,341.457977 222.013229,337.441650 225.017456,333.504395
C240.120148,313.711304 255.179794,293.884796 270.389893,274.174438
C285.617371,254.441574 301.104584,234.908875 316.291901,215.145493
C329.768005,197.608963 342.878021,179.791153 356.351807,162.252823
C371.535828,142.488312 387.042633,122.971779 402.228912,103.208984
C415.704590,85.672318 428.925568,67.939987 442.282043,50.311539
C443.856262,48.233826 445.576691,46.266914 447.622192,44.486465
C440.583649,61.283691 433.201172,77.865234 425.708679,94.396919
C416.240417,115.288162 406.696594,136.145218 397.159790,157.005341
C385.512970,182.480850 373.805145,207.928543 362.192047,233.419388
C356.298615,246.355530 350.562256,259.363190 344.734558,272.329376
C344.077271,273.791779 342.995697,275.342896 346.028412,274.866486
C375.476227,274.866486 404.924042,274.866486 435.103424,274.866486
C434.000427,276.633972 433.432526,277.968536 432.502533,278.965240
C426.517273,285.380066 420.420868,291.691040 414.420563,298.092010
C400.063049,313.408081 385.723633,328.741211 371.406372,344.094940
C362.958649,353.154236 354.573517,362.271820 346.148956,371.352753
C333.229889,385.278442 320.297028,399.191345 307.377899,413.116974
C298.953308,422.197906 290.548889,431.297485 282.124329,440.378448
C269.207367,454.301880 256.276855,468.212769 243.359863,482.136169
C234.935486,491.216888 226.497818,500.285522 218.121536,509.410461
C214.783417,513.046997 211.594635,516.820618 208.668945,520.765869
C208.250000,521.000000 207.500000,521.000000 206.375000,521.000000
z"/>
<path fill="#356CFF" opacity="1.000000" stroke="none"
d="
M678.293213,493.292358
C662.140625,501.540405 645.492554,506.777588 627.688477,508.017548
C623.424805,508.314484 619.165588,508.950897 614.903625,508.957092
C567.915283,509.025421 520.926758,509.000000 473.938293,509.000000
C472.118591,509.000000 470.298859,509.000000 467.688934,509.000000
C469.880035,501.969025 471.907806,495.407806 473.968964,488.857086
C485.504913,452.193695 497.081329,415.542999 508.577881,378.867279
C515.467041,356.889984 522.206543,334.865845 529.070496,312.880585
C532.646729,301.425995 536.437988,290.037750 539.922852,278.556061
C540.727051,275.906403 541.865234,274.938568 544.675415,274.943237
C592.330200,275.022461 639.987305,274.753143 687.638855,275.158752
C700.992065,275.272400 714.399414,277.458313 726.606506,283.370209
C743.820618,291.707031 753.937927,305.783936 756.940918,324.625397
C760.375366,346.174286 756.183655,366.989105 750.006226,387.543335
C744.482483,405.922516 738.246033,424.026733 728.992737,440.921509
C716.963379,462.884735 701.167419,481.263275 678.293213,493.292358
M645.277161,444.946167
C656.078491,439.924896 666.437988,434.065491 672.160767,423.121918
C676.502563,414.819183 679.954590,406.006500 683.258972,397.216431
C688.138977,384.234955 692.832520,371.114319 691.975342,356.883911
C691.292419,345.546265 685.947937,337.440735 674.533508,335.202209
C667.815308,333.884644 660.750671,334.086548 653.839294,334.046967
C631.713440,333.920380 609.586426,333.999939 587.425903,333.999939
C575.299438,373.073425 563.255798,411.879944 551.114868,450.999939
C572.884644,450.999939 594.188782,450.961578 615.492676,451.016724
C625.590759,451.042847 635.183716,448.771362 645.277161,444.946167
z"/>
<path fill="#356CFF" opacity="1.000000" stroke="none"
d="
M793.187134,232.300537
C780.959839,240.012787 768.150085,244.772354 753.859863,245.048050
C748.925598,245.143219 744.000305,245.945221 739.069824,245.956238
C702.740356,246.037460 666.410583,246.000168 630.080933,246.000168
C628.263245,246.000168 626.445557,246.000153 623.933044,246.000153
C621.642456,226.405136 619.371887,206.981918 617.035889,186.998871
C618.953064,186.998871 620.743530,186.998871 622.533936,186.998886
C662.029968,186.998978 701.530029,186.679871 741.019531,187.188843
C753.268799,187.346725 768.272766,173.947617 767.069641,160.637299
C766.547607,154.861893 764.042175,152.019043 758.063110,152.010178
C739.565002,151.982727 721.066833,152.000137 702.568726,152.000137
C688.570129,152.000137 674.571533,152.007858 660.572937,151.997971
C646.498718,151.988037 634.617493,143.702713 629.846619,130.024963
C623.682068,112.351700 625.143311,94.756310 629.477356,77.237671
C633.293518,61.812450 640.117188,47.668446 649.579834,34.740677
C661.873291,17.945644 677.691833,6.904143 698.292419,3.057026
C699.099670,2.906274 699.955078,3.001690 700.788025,3.001681
C757.115662,3.001117 813.443359,3.002246 869.770996,3.008404
C870.268188,3.008459 870.765320,3.078329 871.826111,3.157861
C863.332520,23.487314 854.915283,43.633976 846.406372,64.000061
C834.452026,64.000061 822.464233,64.000053 810.476379,64.000069
C777.812988,64.000107 745.149597,63.972855 712.486328,64.026688
C706.947876,64.035820 702.076660,65.733345 697.768982,69.592628
C692.502563,74.310760 690.721436,82.556221 693.653809,89.214081
C696.617004,95.942009 701.468933,99.968933 710.168457,99.982201
C740.332031,100.028206 770.497498,100.198517 800.658752,99.929565
C820.459839,99.752991 830.588196,112.003365 833.799072,126.717125
C840.006104,155.160141 833.968140,181.395111 817.277283,205.352859
C810.373962,215.261902 803.065491,224.640015 793.187134,232.300537
z"/>
<path fill="#356CFF" opacity="1.000000" stroke="none"
d="
M823.000000,509.000000
C791.510620,509.000000 760.521301,509.000000 728.947021,509.000000
C731.733032,500.372131 734.374329,492.119171 737.062195,483.881348
C748.085510,450.096100 759.125549,416.316254 770.154907,382.532990
C781.134277,348.903381 792.265320,315.321655 802.924622,281.590912
C804.631836,276.188446 806.877380,274.830902 812.386719,274.849823
C879.551208,275.080597 946.716736,274.999756 1013.882019,274.999756
C1015.825684,274.999756 1017.769348,274.999756 1020.467407,274.999756
C1015.935242,285.813599 1011.685791,295.960175 1007.430237,306.104218
C1004.289795,313.590240 1000.952820,321.001373 998.076538,328.587341
C996.649048,332.352051 995.026306,334.153351 990.478210,334.131104
C945.980225,333.913422 901.480469,334.069885 856.982178,333.882568
C852.912659,333.865448 851.043762,335.088165 850.023315,338.831787
C847.589722,347.760406 844.935669,356.628937 842.244995,365.957397
C877.591187,365.957397 912.649841,365.957397 948.562500,365.957397
C945.926086,372.543091 943.548706,378.517181 941.143860,384.480194
C937.380371,393.812286 933.588440,403.132904 929.828918,412.466583
C928.313965,416.227722 926.342529,418.217316 921.512695,418.164948
C891.350220,417.838135 861.182373,418.000000 831.016357,418.000000
C829.196228,418.000000 827.376160,418.000000 825.322754,418.000000
C821.967529,429.012909 818.665588,439.851044 815.273376,450.985413
C862.513733,450.985413 909.475220,450.985413 956.950256,450.985413
C954.152283,459.396942 951.587891,467.488007 948.766968,475.488617
C945.313660,485.282684 941.372803,494.913971 938.220764,504.799927
C937.142883,508.180389 935.796997,509.070801 932.497131,509.061859
C896.164978,508.963348 859.832458,509.000000 823.000000,509.000000
z"/>
<path fill="#356CFF" opacity="1.000000" stroke="none"
d="
M323.998535,147.012787
C319.677765,156.987640 312.015503,158.405701 302.235352,158.221146
C270.762512,157.627304 239.271423,158.000061 207.569260,158.000061
C199.641541,187.317169 191.742508,216.528183 183.817520,245.835236
C158.622452,245.835236 133.651245,245.835236 108.215561,245.835236
C133.637527,164.859695 159.018921,84.013359 184.356949,3.305126
C268.662537,3.305126 352.701477,3.305126 437.464386,3.305126
C430.822906,11.940317 424.546509,20.000668 418.379639,28.143984
C410.504120,38.543591 402.725250,49.016335 394.886719,59.444019
C392.615631,62.465302 390.047546,64.143181 385.764923,64.125465
C337.777008,63.927029 289.787842,64.035896 241.799362,63.926212
C238.291229,63.918194 236.776581,64.770020 235.701431,68.385605
C232.333740,79.710640 228.362366,90.856155 224.377686,102.812965
C268.317383,102.812965 311.480286,102.812965 356.073273,102.812965
C344.894440,118.122437 334.478180,132.387604 323.998535,147.012787
z"/>
<path fill="#356CFF" opacity="1.000000" stroke="none"
d="
M346.143494,274.555603
C342.995697,275.342896 344.077271,273.791779 344.734558,272.329376
C350.562256,259.363190 356.298615,246.355530 362.192047,233.419388
C373.805145,207.928543 385.512970,182.480850 397.159790,157.005341
C406.696594,136.145218 416.240417,115.288162 425.708679,94.396919
C433.201172,77.865234 440.583649,61.283691 447.934875,44.352615
C455.431122,33.958309 463.008911,23.936728 470.582916,13.912311
C472.548004,11.311471 474.230652,8.419254 476.553345,6.193340
C478.158264,4.655246 480.633331,3.149660 482.730927,3.133805
C509.558716,2.931014 536.388855,3.059636 563.217590,2.931406
C566.954163,2.913547 567.812683,4.189710 568.135681,7.810584
C568.991577,17.406889 570.554993,26.938486 571.752258,36.506416
C572.890564,45.603550 573.874878,54.719952 575.013000,63.817116
C576.210022,73.385490 577.553650,82.935524 578.750977,92.503876
C579.889282,101.600929 580.874878,110.717094 582.012939,119.814186
C583.210022,129.382584 584.552551,138.932785 585.749878,148.501175
C586.888184,157.598160 587.859863,166.716110 589.017456,175.810501
C590.193054,185.047348 591.557556,194.260101 592.744751,203.495560
C593.892456,212.424530 594.925537,221.368286 595.997559,230.306931
C596.599609,235.326508 597.178528,240.348862 597.841919,246.000336
C596.091187,246.000336 594.331909,246.000336 592.572632,246.000336
C571.575745,246.000336 550.578003,245.896301 529.582703,246.077759
C524.694336,246.119980 522.054626,245.931732 521.689392,239.496628
C521.072693,228.632385 518.648193,217.872177 517.030701,207.061218
C516.861755,205.932083 517.007996,204.755783 517.007996,203.000336
C515.015869,203.000336 513.236572,203.000336 511.457275,203.000336
C478.962128,203.000336 446.457245,203.437195 413.978210,202.714035
C405.103760,202.516434 400.060760,205.862137 395.184967,212.285187
C384.414642,226.473373 373.224121,240.343063 362.175903,254.319656
C356.904388,260.988403 351.566467,267.604675 346.143494,274.555603
M500.546783,77.941902
C499.403381,79.148605 498.166351,80.280388 497.131592,81.573990
C489.578949,91.015907 482.057983,100.483223 474.544373,109.956299
C465.455444,121.415504 456.383636,132.888321 447.030518,144.701126
C469.403778,144.701126 491.093231,144.701126 512.632446,144.701126
C509.293793,121.461777 505.994019,98.493401 502.565094,74.625969
C501.714691,76.040482 501.329834,76.680641 500.546783,77.941902
z"/>
<path fill="#356CFF" opacity="1.000000" stroke="none"
d="
M1108.270874,39.372978
C1105.357056,47.185581 1102.807251,54.723213 1099.757446,62.052822
C1099.284424,63.189693 1096.526978,63.909969 1094.821045,63.919090
C1072.155884,64.040337 1049.489380,64.071274 1026.824463,63.925091
C1023.333557,63.902576 1021.835510,64.757309 1020.728271,68.369057
C1009.984070,103.414841 998.929321,138.365265 988.023621,173.361771
C980.504333,197.491135 973.080383,221.650253 965.591064,245.869720
C942.456970,245.869720 919.482300,245.869720 896.004700,245.869720
C914.785645,185.316513 933.489685,125.011124 952.406921,64.018448
C926.276794,64.018448 900.747009,64.018448 874.435608,64.018448
C877.990295,54.832458 881.261475,46.401470 884.515625,37.963902
C888.367798,27.975712 892.151001,17.960417 896.085999,8.005063
C897.112732,5.407640 897.802551,2.868970 901.978455,2.878727
C974.475464,3.048127 1046.973022,3.001799 1119.470459,3.008539
C1120.129761,3.008600 1120.789185,3.089758 1122.225952,3.184111
C1117.567139,15.324969 1113.018921,27.177361 1108.270874,39.372978
z"/>
<path fill="#356CFF" opacity="1.000000" stroke="none"
d="
M285.869019,346.467285
C286.805725,346.166626 287.611328,346.166626 288.836304,346.166626
C285.163147,353.989136 281.641479,361.539429 278.077423,369.069611
C268.377380,389.564148 258.618896,410.031128 248.958710,430.544403
C236.974380,455.992981 225.069077,481.478790 213.105774,506.937317
C212.767105,507.657990 212.157883,508.251556 211.337128,509.035217
C187.204910,509.166077 163.410370,509.166077 139.529221,509.166077
C129.313751,430.986267 119.158012,353.263641 108.959923,275.216919
C110.688568,275.136261 112.153008,275.009583 113.617546,275.008514
C131.776428,274.994995 149.936005,275.080048 168.093628,274.928345
C171.501968,274.899902 172.635040,276.166321 173.050140,279.364532
C175.257294,296.369965 177.717316,313.342499 179.938034,330.346252
C181.738541,344.132507 183.211319,357.961792 185.037476,371.744415
C186.881424,385.661407 189.081894,399.531067 190.938217,413.446533
C192.489594,425.076019 193.769485,436.741760 195.280121,449.310944
C199.981659,444.212219 204.268433,439.741760 208.351959,435.092773
C214.420776,428.183533 220.315491,421.121704 226.338791,414.172028
C237.429550,401.375580 248.504379,388.564545 259.691833,375.852875
C268.289612,366.083740 277.049896,356.457672 285.869019,346.467285
z"/>
<path fill="#356CFF" opacity="1.000000" stroke="none"
d="
M427.288269,332.344727
C433.339813,314.102020 439.121582,296.186249 445.128143,278.346130
C445.594910,276.959686 447.627594,275.155060 448.947510,275.142670
C469.444519,274.950195 489.944061,275.019318 510.442963,275.048981
C510.900421,275.049622 511.357513,275.296814 512.292480,275.567169
C509.525726,284.787659 506.764557,293.921906 504.044037,303.068268
C495.997742,330.119476 488.071899,357.207062 479.905182,384.221863
C469.064331,420.082458 458.027954,455.883942 447.109985,491.721252
C445.644867,496.530426 444.529694,501.451294 442.916718,506.206573
C442.522949,507.367523 440.806915,508.871368 439.689850,508.878876
C416.546112,509.034119 393.401093,508.995850 369.605469,508.995850
C372.934265,498.781586 376.082092,489.093536 379.248596,479.411591
C390.597931,444.709503 401.968536,410.014343 413.299713,375.306274
C417.932861,361.114594 422.485901,346.896729 427.288269,332.344727
z"/>
<path fill="#356CFF" opacity="1.000000" stroke="none"
d="
M138.037796,37.097782
C141.295288,26.660570 144.674210,16.675442 147.631958,6.567070
C148.458282,3.742993 149.645508,2.893522 152.405807,2.951648
C159.393219,3.098789 166.385803,3.000472 173.856400,3.000472
C148.378799,84.129539 122.994667,164.960953 97.634827,245.715027
C89.355797,245.715027 81.276062,245.715027 72.690941,245.715027
C76.572350,233.095428 80.250046,220.851959 84.103249,208.663971
C95.586159,172.342590 107.181030,136.056595 118.646225,99.729652
C125.184052,79.014847 131.554260,58.247139 138.037796,37.097782
z"/>
<path fill="#356CFF" opacity="1.000000" stroke="none"
d="
M76.721054,299.419922
C75.488724,291.325104 74.461586,283.635040 73.368988,275.454834
C81.571190,275.454834 89.451981,275.454834 98.111282,275.454834
C108.246529,352.989197 118.422234,430.833038 128.620285,508.847900
C120.492012,508.847900 112.528656,508.847900 103.984673,508.847900
C102.985077,501.570618 101.987190,494.345764 101.001320,487.119263
C99.433640,475.628082 97.832642,464.141266 96.324249,452.642273
C95.154007,443.721130 94.144417,434.778961 92.988594,425.855835
C91.813423,416.783386 90.516373,407.726776 89.328629,398.655884
C88.181999,389.898987 87.154549,381.126373 85.988327,372.372192
C84.435532,360.716309 82.747688,349.078339 81.215462,337.419830
C80.064041,328.658783 79.037918,319.880798 78.013512,311.103638
C77.575737,307.352753 77.284218,303.584808 76.721054,299.419922
z"/>
<path fill="#356CFF" opacity="1.000000" stroke="none"
d="
M53.285217,235.354004
C52.371040,238.372971 51.892857,241.133865 50.855000,243.665298
C50.431515,244.698212 48.842243,245.794510 47.701450,245.890671
C44.255535,246.181259 40.769463,245.995621 36.871075,245.995621
C41.349781,231.792267 45.688026,218.051437 50.015446,204.307205
C59.172226,175.224564 68.323456,146.140152 77.476776,117.056412
C84.829094,93.695175 92.209694,70.342781 99.522072,46.969044
C103.590233,33.965286 107.688278,20.967325 111.460510,7.876744
C112.558449,4.066622 114.181557,2.340968 118.253426,2.935123
C120.681496,3.289421 123.203484,3.000076 126.243896,3.000076
C123.371277,12.431283 120.728195,21.405510 117.905869,30.323011
C106.405334,66.660454 94.789261,102.961411 83.337395,139.314133
C76.416466,161.283859 69.742783,183.331375 62.910313,205.329132
C59.832245,215.239258 56.637707,225.113220 53.285217,235.354004
z"/>
<path fill="#356CFF" opacity="1.000000" stroke="none"
d="
M72.043411,441.731567
C73.050293,448.632874 74.073578,455.072845 74.988213,461.528229
C76.316200,470.900909 77.625465,480.277039 78.827858,489.666412
C79.631248,495.940033 80.235046,502.239197 80.953033,508.752563
C76.519943,508.752563 72.438980,508.752563 68.225517,508.752563
C58.043629,430.857574 47.891350,353.189117 37.699081,275.214722
C42.386536,275.214722 46.331650,275.214722 50.578835,275.214722
C51.715908,283.876038 52.831028,292.577728 54.006241,301.271301
C55.602306,313.078064 57.286518,324.873077 58.852421,336.683777
C59.969955,345.112701 60.895794,353.567078 62.013474,361.995972
C63.601089,373.968781 65.361946,385.918884 66.904999,397.897217
C68.054939,406.823975 68.963661,415.781616 70.005669,424.722504
C70.649132,430.243622 71.341072,435.759125 72.043411,441.731567
z"/>
<path fill="#356CFF" opacity="1.000000" stroke="none"
d="
M25.960548,194.919388
C20.814678,211.391403 15.707582,227.457230 10.517684,243.783524
C8.633832,243.783524 6.525373,243.783524 3.955338,243.783524
C4.472698,241.416031 4.779933,239.214020 5.437377,237.122086
C13.992743,209.899582 22.589426,182.690063 31.192583,155.482605
C40.332436,126.577866 49.528023,97.690689 58.627193,68.773163
C64.806946,49.133678 71.100830,29.523956 76.813156,9.747686
C78.321388,4.526131 80.699463,3.104707 85.692398,4.342134
C80.430092,21.341099 75.244125,38.376793 69.881874,55.356815
C58.408974,91.686684 46.827457,127.982246 35.329453,164.304214
C32.148888,174.351547 29.105597,184.442337 25.960548,194.919388
z"/>
<path fill="#356CFF" opacity="1.000000" stroke="none"
d="
M27.999187,408.097290
C29.209997,417.784271 30.437838,427.014008 31.625261,436.248871
C32.771866,445.166229 33.826576,454.095581 35.012585,463.007568
C36.541531,474.496460 38.184998,485.970062 39.725979,497.457397
C40.159004,500.685425 40.405422,503.938446 40.778835,507.584167
C38.873970,507.584167 36.839798,507.584167 33.949539,507.584167
C23.950878,431.144440 13.903301,354.330780 3.817110,277.221924
C6.365981,277.221924 8.315143,277.221924 10.679947,277.221924
C11.776448,285.480652 12.874923,293.856415 14.003654,302.228088
C15.225304,311.288910 16.513916,320.340912 17.701656,329.406128
C18.848600,338.159973 19.858631,346.931824 21.012688,355.684692
C22.186155,364.584747 23.492712,373.467224 24.682487,382.365173
C25.506033,388.524200 26.217030,394.698151 27.005978,400.861908
C27.295940,403.127258 27.665359,405.382477 27.999187,408.097290
z"/>
<path fill="#000000" opacity="1.000000" stroke="none"
d="
M1050.992432,424.007019
C1051.327148,415.954803 1050.603760,408.110260 1052.220459,400.782074
C1056.119873,383.108765 1062.766113,366.525848 1076.058838,353.430695
C1087.608887,342.052185 1101.664917,335.288361 1117.471558,333.214355
C1130.515137,331.502991 1143.843872,330.738434 1156.973755,331.286560
C1168.062378,331.749451 1179.896606,332.948700 1187.750000,342.550415
C1190.452393,345.854401 1192.202637,350.543091 1192.819580,354.825134
C1194.271362,364.900970 1191.473145,374.657928 1189.004272,384.367889
C1184.383545,402.539856 1177.084961,419.355957 1163.065063,432.310730
C1151.305054,443.177185 1137.213867,449.861359 1121.302490,451.891510
C1111.361816,453.159821 1101.244751,454.202789 1091.273560,453.778687
C1078.980225,453.255829 1066.987549,450.825684 1058.059937,440.707397
C1053.834106,435.917755 1051.867676,430.512054 1050.992432,424.007019
z"/>
<path fill="#000000" opacity="1.000000" stroke="none"
d="
M644.891235,445.016296
C635.183716,448.771362 625.590759,451.042847 615.492676,451.016724
C594.188782,450.961578 572.884644,450.999939 551.114868,450.999939
C563.255798,411.879944 575.299438,373.073425 587.425903,333.999939
C609.586426,333.999939 631.713440,333.920380 653.839294,334.046967
C660.750671,334.086548 667.815308,333.884644 674.533508,335.202209
C685.947937,337.440735 691.292419,345.546265 691.975342,356.883911
C692.832520,371.114319 688.138977,384.234955 683.258972,397.216431
C679.954590,406.006500 676.502563,414.819183 672.160767,423.121918
C666.437988,434.065491 656.078491,439.924896 644.891235,445.016296
z"/>
<path fill="#000000" opacity="1.000000" stroke="none"
d="
M500.745880,77.631348
C501.329834,76.680641 501.714691,76.040482 502.565094,74.625969
C505.994019,98.493401 509.293793,121.461777 512.632446,144.701126
C491.093231,144.701126 469.403778,144.701126 447.030518,144.701126
C456.383636,132.888321 465.455444,121.415504 474.544373,109.956299
C482.057983,100.483223 489.578949,91.015907 497.131592,81.573990
C498.166351,80.280388 499.403381,79.148605 500.745880,77.631348
z"/>
</svg>

After

Width:  |  Height:  |  Size: 41 KiB

@@ -0,0 +1,169 @@
import argparse
import os
from copy import deepcopy
import gradio as gr
import torch
from fastvideo import VideoGenerator
from fastvideo.configs.sample.base import SamplingParam
if __name__ == "__main__":
os.environ["FASTVIDEO_ATTENTION_BACKEND"] = "VIDEO_SPARSE_ATTN"
parser = argparse.ArgumentParser(description="FastVideo Gradio Demo")
parser.add_argument("--model_path",
type=str,
default="FastVideo/FastWan2.1-T2V-1.3B-Diffusers",
help="Path to the model")
parser.add_argument("--num_gpus",
type=int,
default=1,
help="Number of GPUs to use")
parser.add_argument("--output_path",
type=str,
default="my_videos/",
help="Path to save generated videos")
parsed_args = parser.parse_args()
generator = VideoGenerator.from_pretrained(
model_path=parsed_args.model_path, num_gpus=parsed_args.num_gpus)
default_params = SamplingParam.from_pretrained(parsed_args.model_path)
def generate_video(
prompt,
negative_prompt,
use_negative_prompt,
seed,
guidance_scale,
num_frames,
height,
width,
num_inference_steps,
randomize_seed=False,
):
params = deepcopy(default_params)
params.prompt = prompt
params.negative_prompt = negative_prompt
params.seed = seed
params.guidance_scale = guidance_scale
params.num_frames = num_frames
params.height = height
params.width = width
params.num_inference_steps = num_inference_steps
if randomize_seed:
params.seed = torch.randint(0, 1000000, (1, )).item()
if use_negative_prompt and negative_prompt:
params.negative_prompt = negative_prompt
else:
params.negative_prompt = default_params.negative_prompt
generator.generate_video(prompt=prompt, sampling_param=params,output_path=parsed_args.output_path,save_video=True)
output_path = os.path.join(parsed_args.output_path,
f"{params.prompt[:100]}.mp4")
return output_path, params.seed
examples = [
"A curious raccoon peers through a vibrant field of yellow sunflowers, its eyes wide with interest.",
]
with gr.Blocks() as demo:
gr.Markdown("# FastVideo Inference Demo")
with gr.Group():
with gr.Row():
prompt = gr.Text(
label="Prompt",
show_label=False,
max_lines=1,
placeholder="Enter your prompt",
container=False,
)
run_button = gr.Button("Run", scale=0)
result = gr.Video(label="Result", show_label=False)
with gr.Accordion("Advanced options", open=False):
with gr.Group():
with gr.Row():
height = gr.Slider(
label="Height",
minimum=256,
maximum=1024,
step=32,
value=default_params.height,
)
width = gr.Slider(label="Width",
minimum=256,
maximum=1024,
step=32,
value=default_params.width)
with gr.Row():
num_frames = gr.Slider(
label="Number of Frames",
minimum=21,
maximum=163,
value=default_params.num_frames,
)
guidance_scale = gr.Slider(
label="Guidance Scale",
minimum=1,
maximum=12,
value=default_params.guidance_scale,
)
num_inference_steps = gr.Slider(
label="Inference Steps",
minimum=3,
maximum=100,
value=default_params.num_inference_steps,
)
with gr.Row():
use_negative_prompt = gr.Checkbox(
label="Use negative prompt", value=False)
negative_prompt = gr.Text(
label="Negative prompt",
max_lines=1,
placeholder="Enter your negative prompt",
visible=False,
)
seed = gr.Slider(label="Seed",
minimum=0,
maximum=1000000,
step=1,
value=default_params.seed)
randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
seed_output = gr.Number(label="Used Seed")
gr.Examples(examples=examples, inputs=prompt)
use_negative_prompt.change(
fn=lambda x: gr.update(visible=x),
inputs=use_negative_prompt,
outputs=negative_prompt,
)
run_button.click(
fn=generate_video,
inputs=[
prompt,
negative_prompt,
use_negative_prompt,
seed,
guidance_scale,
num_frames,
height,
width,
num_inference_steps,
randomize_seed,
],
outputs=[result, seed_output],
)
demo.queue(max_size=20).launch(server_name="0.0.0.0", server_port=8888)
@@ -0,0 +1,656 @@
import argparse
import os
import base64
import time
import gradio as gr
from fastvideo.entrypoints.video_generator import VideoGenerator
from fastvideo.configs.sample.base import SamplingParam
from copy import deepcopy
MODEL_PATH_MAPPING = {
"FastWan2.1-T2V-1.3B": "FastVideo/FastWan2.1-T2V-1.3B-Diffusers",
"FastWan2.2-TI2V-5B-FullAttn": "FastVideo/FastWan2.2-TI2V-5B-FullAttn-Diffusers",
}
def create_timing_display(inference_time, total_time, stage_execution_times, num_frames):
dit_denoising_time = f"{stage_execution_times[5]:.2f}s" if len(stage_execution_times) > 5 else "N/A"
timing_html = f"""
<div style="margin: 10px 0;">
<h3 style="text-align: center; margin-bottom: 10px;">⏱️ Timing Breakdown</h3>
<div style="display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 10px;">
<div class="timing-card timing-card-highlight">
<div style="font-size: 20px;">🚀</div>
<div style="font-weight: bold; margin: 3px 0; font-size: 14px;">DiT Denoising</div>
<div style="font-size: 16px; color: #ffa200; font-weight: bold;">{dit_denoising_time}</div>
</div>
<div class="timing-card">
<div style="font-size: 20px;">🧠</div>
<div style="font-weight: bold; margin: 3px 0; font-size: 14px;">E2E (w. vae/text encoder)</div>
<div style="font-size: 16px; color: #2563eb;">{inference_time:.2f}s</div>
</div>
<div class="timing-card">
<div style="font-size: 20px;">🎬</div>
<div style="font-weight: bold; margin: 3px 0; font-size: 14px;">Video Encoding</div>
<div style="font-size: 16px; color: #dc2626;">N/A</div>
</div>
<div class="timing-card">
<div style="font-size: 20px;">🌐</div>
<div style="font-weight: bold; margin: 3px 0; font-size: 14px;">Network Transfer</div>
<div style="font-size: 16px; color: #059669;">N/A</div>
</div>
<div class="timing-card">
<div style="font-size: 20px;">📊</div>
<div style="font-weight: bold; margin: 3px 0; font-size: 14px;">Total Processing</div>
<div style="font-size: 18px; color: #0277bd;">{total_time:.2f}s</div>
</div>
</div>"""
if inference_time > 0:
fps = num_frames / inference_time
timing_html += f"""
<div class="performance-card" style="margin-top: 15px;">
<span style="font-weight: bold;">Generation Speed: </span>
<span style="font-size: 18px; color: #6366f1; font-weight: bold;">{fps:.1f} frames/second</span>
</div>"""
return timing_html + "</div>"
def setup_model_environment(model_path: str) -> None:
if "fullattn" in model_path.lower():
os.environ["FASTVIDEO_ATTENTION_BACKEND"] = "FLASH_ATTN"
else:
os.environ["FASTVIDEO_ATTENTION_BACKEND"] = "VIDEO_SPARSE_ATTN"
os.environ["FASTVIDEO_STAGE_LOGGING"] = "1"
def load_example_prompts():
def contains_chinese(text):
return any('\u4e00' <= char <= '\u9fff' for char in text)
def load_from_file(filepath):
prompts, labels = [], []
try:
with open(filepath, "r", encoding='utf-8') as f:
for line in f:
line = line.strip()
if line and not contains_chinese(line):
label = line[:100] + "..." if len(line) > 100 else line
labels.append(label)
prompts.append(line)
except Exception as e:
print(f"Warning: Could not read {filepath}: {e}")
return prompts, labels
examples, example_labels = load_from_file("prompts/prompts_final.txt")
if not examples:
examples = ["A crowded rooftop bar buzzes with energy, the city skyline twinkling like a field of stars in the background."]
example_labels = ["Crowded rooftop bar at night"]
return examples, example_labels
def create_gradio_interface(default_params: dict[str, SamplingParam], generators: dict[str, VideoGenerator]):
def generate_video(
prompt, negative_prompt, use_negative_prompt, seed, guidance_scale,
num_frames, height, width, randomize_seed, model_selection, progress
):
model_path = MODEL_PATH_MAPPING.get(model_selection, "FastVideo/FastWan2.1-T2V-1.3B-Diffusers")
setup_model_environment(model_path)
try:
if progress:
progress(0.1, desc="Loading model for local inference...")
generator = generators[model_path]
params = deepcopy(default_params[model_path])
total_start_time = time.time()
if progress:
progress(0.2, desc="Configuring parameters...")
params.prompt = prompt
params.seed = int(seed)
params.guidance_scale = guidance_scale
params.num_frames = int(num_frames)
params.height = int(height)
params.width = int(width)
if randomize_seed:
params.seed = torch.randint(0, 1000000, (1, )).item()
if use_negative_prompt and negative_prompt:
params.negative_prompt = negative_prompt
else:
params.negative_prompt = default_params[model_path].negative_prompt
if progress:
progress(0.4, desc="Generating video locally...")
output_dir = "outputs/"
os.makedirs(output_dir, exist_ok=True)
start_time = time.time()
result = generator.generate_video(prompt=prompt, sampling_param=params, save_video=False, return_frames=False)
inference_time = time.time() - start_time
logging_info = result.get("logging_info", None)
if logging_info:
stage_names = logging_info.get_execution_order()
stage_execution_times = [
logging_info.get_stage_info(stage_name).get("execution_time", 0.0)
for stage_name in stage_names
]
else:
stage_names = []
stage_execution_times = []
total_time = time.time() - total_start_time
timing_details=create_timing_display(inference_time=inference_time, total_time=total_time, stage_execution_times=stage_execution_times, num_frames=params.num_frames)
safe_prompt = params.prompt[:100].replace(' ', '_').replace('/', '_').replace('\\', '_')
video_filename = f"{params.prompt[:100]}.mp4"
output_path = os.path.join(output_dir, video_filename)
if progress:
progress(1.0, desc="Generation complete!")
return output_path, params.seed, timing_details
except Exception as e:
print(f"An error occurred during local generation: {e}")
return None, f"Generation failed: {str(e)}", ""
examples, example_labels = load_example_prompts()
theme = gr.themes.Base().set(
button_primary_background_fill="#2563eb",
button_primary_background_fill_hover="#1d4ed8",
button_primary_text_color="white",
slider_color="#2563eb",
checkbox_background_color_selected="#2563eb",
)
def get_default_values(model_name):
model_path = MODEL_PATH_MAPPING.get(model_name)
if model_path and model_path in default_params:
params = default_params[model_path]
return {
'height': params.height,
'width': params.width,
'num_frames': params.num_frames,
'guidance_scale': params.guidance_scale,
'seed': params.seed,
}
return {
'height': 448,
'width': 832,
'num_frames': 61,
'guidance_scale': 3.0,
'seed': 1024,
}
initial_values = get_default_values("FastWan2.1-T2V-1.3B")
with gr.Blocks(title="FastWan", theme=theme) as demo:
gr.Image("fastvideo-logos/main/svg/full.svg", show_label=False, container=False, height=80)
gr.HTML("""
<div style="text-align: center; margin-bottom: 10px;">
<p style="font-size: 18px;"> Make Video Generation Go Blurrrrrrr </p>
<p style="font-size: 18px;"> <a href="https://github.com/hao-ai-lab/FastVideo/tree/main" target="_blank">Code</a> | <a href="https://hao-ai-lab.github.io/blogs/fastvideo_post_training/" target="_blank">Blog</a> | <a href="https://hao-ai-lab.github.io/FastVideo/" target="_blank">Docs</a> </p>
</div>
""")
with gr.Accordion("🎥 What Is FastVideo?", open=False):
gr.HTML("""
<div style="padding: 20px; line-height: 1.6;">
<p style="font-size: 16px; margin-bottom: 15px;">
FastVideo is an inference and post-training framework for diffusion models. It features an end-to-end unified pipeline for accelerating diffusion models, starting from data preprocessing to model training, finetuning, distillation, and inference. FastVideo is designed to be modular and extensible, allowing users to easily add new optimizations and techniques. Whether it is training-free optimizations or post-training optimizations, FastVideo has you covered.
</p>
</div>
""")
with gr.Row():
model_selection = gr.Dropdown(
choices=list(MODEL_PATH_MAPPING.keys()),
value="FastWan2.1-T2V-1.3B",
label="Select Model",
interactive=True
)
with gr.Row():
example_dropdown = gr.Dropdown(
choices=example_labels,
label="Example Prompts",
value=None,
interactive=True,
allow_custom_value=False
)
with gr.Row():
with gr.Column(scale=6):
prompt = gr.Text(
label="Prompt",
show_label=False,
max_lines=3,
placeholder="Describe your scene...",
container=False,
lines=3,
autofocus=True,
)
with gr.Column(scale=1, min_width=120, elem_classes="center-button"):
run_button = gr.Button("Run", variant="primary", size="lg")
with gr.Row():
with gr.Column():
error_output = gr.Text(label="Error", visible=False)
timing_display = gr.Markdown(label="Timing Breakdown", visible=False)
with gr.Row(equal_height=True, elem_classes="main-content-row"):
with gr.Column(scale=1, elem_classes="advanced-options-column"):
with gr.Group():
gr.HTML("<div style='margin: 0 0 15px 0; text-align: center; font-size: 16px;'>Advanced Options</div>")
with gr.Row():
height = gr.Number(
label="Height",
value=initial_values['height'],
interactive=False,
container=True
)
width = gr.Number(
label="Width",
value=initial_values['width'],
interactive=False,
container=True
)
with gr.Row():
num_frames = gr.Number(
label="Number of Frames",
value=initial_values['num_frames'],
interactive=False,
container=True
)
guidance_scale = gr.Slider(
label="Guidance Scale",
minimum=1,
maximum=12,
value=initial_values['guidance_scale'],
)
with gr.Row():
use_negative_prompt = gr.Checkbox(
label="Use negative prompt", value=False)
negative_prompt = gr.Text(
label="Negative prompt",
max_lines=3,
lines=3,
placeholder="Enter a negative prompt",
visible=False,
)
seed = gr.Slider(
label="Seed",
minimum=0,
maximum=1000000,
step=1,
value=initial_values['seed'],
)
randomize_seed = gr.Checkbox(label="Randomize seed", value=False)
seed_output = gr.Number(label="Used Seed")
with gr.Column(scale=1, elem_classes="video-column"):
result = gr.Video(
label="Generated Video",
show_label=True,
height=466,
width=600,
container=True,
elem_classes="video-component"
)
gr.HTML("""
<style>
.center-button {
display: flex !important;
justify-content: center !important;
height: 100% !important;
padding-top: 1.4em !important;
}
.gradio-container {
max-width: 1200px !important;
margin: 0 auto !important;
}
.main {
max-width: 1200px !important;
margin: 0 auto !important;
}
.gr-form, .gr-box, .gr-group {
max-width: 1200px !important;
}
.gr-video {
max-width: 500px !important;
margin: 0 auto !important;
}
.main-content-row {
display: flex !important;
align-items: flex-start !important;
min-height: 500px !important;
gap: 20px !important;
}
.advanced-options-column,
.video-column {
display: flex !important;
flex-direction: column !important;
flex: 1 !important;
min-height: 400px !important;
align-items: stretch !important;
}
.video-column > * {
margin-top: 0 !important;
}
.video-column .gr-video,
.video-component {
margin-top: 0 !important;
padding-top: 0 !important;
}
.video-column .gr-video .gr-form {
margin-top: 0 !important;
}
.advanced-options-column .gr-group,
.video-column .gr-video {
margin-top: 0 !important;
vertical-align: top !important;
}
.advanced-options-column > *:last-child,
.video-column > *:last-child {
flex-grow: 0 !important;
}
@media (max-width: 1400px) {
.main-content-row {
min-height: 600px !important;
}
.advanced-options-column,
.video-column {
min-height: 600px !important;
}
}
@media (max-width: 1200px) {
.main-content-row {
flex-direction: column !important;
align-items: stretch !important;
}
.advanced-options-column,
.video-column {
min-height: auto !important;
width: 100% !important;
}
}
.timing-card {
background: var(--background-fill-secondary) !important;
border: 1px solid var(--border-color-primary) !important;
color: var(--body-text-color) !important;
padding: 10px;
border-radius: 8px;
text-align: center;
min-height: 80px;
display: flex;
flex-direction: column;
justify-content: center;
}
.timing-card-highlight {
background: var(--background-fill-primary) !important;
border: 2px solid var(--color-accent) !important;
}
.performance-card {
background: var(--background-fill-secondary) !important;
border: 1px solid var(--border-color-primary) !important;
color: var(--body-text-color) !important;
padding: 10px;
border-radius: 6px;
text-align: center;
}
.gr-number input[readonly] {
background-color: var(--background-fill-secondary) !important;
border: 1px solid var(--border-color-primary) !important;
color: var(--body-text-color-subdued) !important;
cursor: default !important;
text-align: center !important;
font-weight: 500 !important;
}
</style>
""")
def on_example_select(example_label):
if example_label and example_label in example_labels:
index = example_labels.index(example_label)
return examples[index]
return ""
example_dropdown.change(
fn=on_example_select,
inputs=example_dropdown,
outputs=prompt,
)
gr.HTML("""
<div style="text-align: center; margin-top: 10px; margin-bottom: 15px;">
<p style="font-size: 16px; margin: 0;">The compute for this demo is generously provided by <a href="https://www.gmicloud.ai/" target="_blank">GMI Cloud</a>. Note that this demo is meant to showcase FastWan's quality and that under a large number of requests, generation speed may be affected. We are also rate-limiting users to 3 requests per minute.</p>
</div>
""")
use_negative_prompt.change(
fn=lambda x: gr.update(visible=x),
inputs=use_negative_prompt,
outputs=negative_prompt,
)
def on_model_selection_change(selected_model):
if not selected_model:
selected_model = "FastWan2.1-T2V-1.3B"
model_path = MODEL_PATH_MAPPING.get(selected_model)
if model_path and model_path in default_params:
params = default_params[model_path]
return (
gr.update(value=params.height),
gr.update(value=params.width),
gr.update(value=params.num_frames),
gr.update(value=params.guidance_scale),
gr.update(value=params.seed),
)
return (
gr.update(value=448),
gr.update(value=832),
gr.update(value=61),
gr.update(value=3.0),
gr.update(value=1024),
)
model_selection.change(
fn=on_model_selection_change,
inputs=model_selection,
outputs=[height, width, num_frames, guidance_scale, seed],
)
def handle_generation(*args, progress=None, request: gr.Request = None):
model_selection, prompt, negative_prompt, use_negative_prompt, seed, guidance_scale, num_frames, height, width, randomize_seed = args
result_path, seed_or_error, timing_details = generate_video(
prompt, negative_prompt, use_negative_prompt, seed, guidance_scale,
num_frames, height, width, randomize_seed, model_selection, progress
)
if result_path and os.path.exists(result_path):
return (
result_path,
seed_or_error,
gr.update(visible=False),
gr.update(visible=True, value=timing_details),
)
else:
return (
None,
seed_or_error,
gr.update(visible=True, value=seed_or_error),
gr.update(visible=False),
)
run_button.click(
fn=handle_generation,
inputs=[
model_selection,
prompt,
negative_prompt,
use_negative_prompt,
seed,
guidance_scale,
num_frames,
height,
width,
randomize_seed,
],
outputs=[result, seed_output, error_output, timing_display],
concurrency_limit=20,
)
return demo
def main():
parser = argparse.ArgumentParser(description="FastVideo Gradio Frontend")
parser.add_argument("--t2v_model_paths", type=str,
default="FastVideo/FastWan2.1-T2V-1.3B-Diffusers",
help="Comma separated list of paths to the T2V model(s)")
parser.add_argument("--host", type=str, default="0.0.0.0",
help="Host to bind to")
parser.add_argument("--port", type=int, default=7860,
help="Port to bind to")
args = parser.parse_args()
generators = {}
default_params = {}
model_paths = args.t2v_model_paths.split(",")
for model_path in model_paths:
print(f"Loading model: {model_path}")
setup_model_environment(model_path)
generators[model_path] = VideoGenerator.from_pretrained(model_path)
default_params[model_path] = SamplingParam.from_pretrained(model_path)
demo = create_gradio_interface(default_params, generators)
print(f"Starting Gradio frontend at http://{args.host}:{args.port}")
print(f"T2V Models: {args.t2v_model_paths}")
from fastapi import FastAPI, Request, HTTPException
from fastapi.responses import HTMLResponse, FileResponse
import uvicorn
app = FastAPI()
@app.get("/logo.png")
def get_logo():
return FileResponse(
"fastvideo-logos/main/svg/full.svg",
media_type="image/svg+xml",
headers={
"Cache-Control": "public, max-age=3600",
"Access-Control-Allow-Origin": "*"
}
)
@app.get("/favicon.ico")
def get_favicon():
favicon_path = "fastvideo-logos/main/svg/icon-simple.svg"
if os.path.exists(favicon_path):
return FileResponse(
favicon_path,
media_type="image/svg+xml",
headers={
"Cache-Control": "public, max-age=3600",
"Access-Control-Allow-Origin": "*"
}
)
else:
raise HTTPException(status_code=404, detail="Favicon not found")
@app.get("/", response_class=HTMLResponse)
def index(request: Request):
base_url = str(request.base_url).rstrip('/')
return f"""
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>FastWan</title>
<meta name="title" content="FastWan">
<meta name="description" content="Make video generation go blurrrrrrr">
<meta name="keywords" content="FastVideo, video generation, AI, machine learning, FastWan">
<meta property="og:type" content="website">
<meta property="og:url" content="{base_url}/">
<meta property="og:title" content="FastWan">
<meta property="og:description" content="Make video generation go blurrrrrrr">
<meta property="og:image" content="{base_url}/logo.png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:site_name" content="FastWan">
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:url" content="{base_url}/">
<meta property="twitter:title" content="FastWan">
<meta property="twitter:description" content="Make video generation go blurrrrrrr">
<meta property="twitter:image" content="{base_url}/logo.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon.ico">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon.ico">
<link rel="apple-touch-icon" href="/favicon.ico">
<style>
body, html {{
margin: 0;
padding: 0;
height: 100%;
overflow: hidden;
}}
iframe {{
width: 100%;
height: 100vh;
border: none;
}}
</style>
</head>
<body>
<iframe src="/gradio" width="100%" height="100%" style="border: none;"></iframe>
</body>
</html>
"""
app = gr.mount_gradio_app(
app,
demo,
path="/gradio",
allowed_paths=[os.path.abspath("outputs"), os.path.abspath("fastvideo-logos")]
)
uvicorn.run(app, host=args.host, port=args.port)
if __name__ == "__main__":
main()